Closed fxn closed 3 years ago
Yes, it looks like the warning is correct. assert_reply
is a macro that binds the variable reason
. Since it's bound in an anonymous function it will not escape the scope the function and it is indeed unused.
The assert_reply
macro in phoenix could be improved to suppress the warning, like is done for the assert_receive
etc. macros in ex_unit.
EDIT: Since reason
is not used you can fix the warning by adding an underscore: assert_reply ref, :error, %{reason: _reason}
.
Oh, I see, the payload is a pattern of course (it is documented).
In this case, I believe I should pin reason
because I want to test the payload:
assert_reply ref, :error, %{reason: ^reason}
So 1.10 did not issue a warning here and the suite passed. 1.11 uncovered this test was not testing what I wanted to test. Excellent!
Thanks @ericmj!
Yo! Elixir 1.11 warns that the variable
reason
is unused in this test:where
assert_log
is a function:Is that warning legit?