(#942) Added tests that check if replicate reports errors

I messed up the commit history (forgot to do it on clean master), so I'm opening a new pull request for this.