unite icon indicating copy to clipboard operation
unite copied to clipboard

Confusing messages for `?assertException/2`

Open andytill opened this issue 9 years ago • 3 comments

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.

andytill avatar Dec 01 '15 16:12 andytill

The exception is unexpected because the binaries are not identical (Unexepected vs Unexpected).

eproxus avatar Mar 21 '18 12:03 eproxus

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 avatar Mar 21 '18 12:03 andytill

@andytill Good point, a diff of the exceptions would have been nice here 😁 Reopening...

eproxus avatar Mar 21 '18 12:03 eproxus