unite
unite copied to clipboard
Confusing messages for `?assertException/2`
Messages look like this:
1) symbols_in_identifier_3_test/0 (test/lexer_tests.erl:28)
Unexpected exception:
exception error: <<"Unexepected token '^'.">>
in function riak_ql_lexer:yyaction/4 (src/riak_ql_lexer.erl, line 4685)
in call from riak_ql_lexer:string/4 (src/riak_ql_lexer.erl, line 112)
in call from riak_ql_lexer:lex/1 (src/riak_ql_lexer.erl, line 43)
For test:
symbols_in_identifier_3_test() ->
?assertError(
<<"Unexpected token '^'.">>,
error(<<"Unexepected token '^'.">>)
).
The exception is expected because of the assert and should show the diff for the exception reason.
The exception is unexpected because the binaries are not identical (Unexepected
vs Unexpected
).
This spelling is why it was difficult to debug, if this failure had been an equality check unite would have given a diff and clearly shown the error.
@andytill Good point, a diff of the exceptions would have been nice here 😁 Reopening...