Closed oneeman closed 9 years ago
We should add a guard clause to flunk that asserts a binary is given and just fix the assertion directly! Good catch btw!
José Valim www.plataformatec.com.br Skype: jv.ptec Founder and Lead Developer
Right!
Adding the guard, the error no longer crashes the suite and instead points in the right direction:
1) test demo_flunk_error (Kernel.ErrorsTest)
test/elixir/kernel/errors_test.exs:86
** (FunctionClauseError) no function clause matching in ExUnit.Assertions.flunk/1
stacktrace:
test/elixir/test_helper.exs:74: CompileAssertion.assert_compile_fail/2
test/elixir/kernel/errors_test.exs:87
(added :demo_flunk_error
test just to try it out, not keeping it)
Just to clarify: when you say "just fix the assertion directly" you mean the flunk
call in format_rescue
that was causing the trouble?
Just to clarify: when you say "just fix the assertion directly" you mean the flunk call in format_rescue that was causing the trouble?
Yes. :)
Any test using
assert_compile_fail
which should fail instead crashes the test suite.The stacktrace is along the lines of:
The cause of the problem is in
format_rescue
intest_helper.exs
, line 103:result || flunk(message: "Expected expression to fail")
should beresult || flunk("Expected expression to fail")
I can do a PR, but wasn't sure whether we should also add some tests for this (
test_helper_test.exs
?) and what the test strategy would be. I can look into it further.