Use `error` test function when testing for errors

This will give better error messages when tests are failing