-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:14:14] [ds:14:14:10] [async-threads:1] [jit]
Elixir 1.17.2 (compiled with Erlang/OTP 27)
Operating system
macOS
Current behavior
While trying to extract some common assertions into a test support module, encountered an issue with dialyzer and refute macro from ExUnit assertions. This is the minimal helper module that exhibits the error:
defmodule Demo.Test.Helpers do
import ExUnit.Assertions
def assert_success(log) do
assert log =~ "success"
refute log =~ "failure"
end
endAnd this is the result of dialyzer call:
➜ MIX_ENV=test mix dialyzer
Total errors: 1, Skipped: 0, Unnecessary Skips: 27
done in 0m5.49s
test/support/helpers.ex:6:guard_fail
The guard clause:
when _ :: true === nil
can never succeed.
________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
Using e.g. refute log =~ "failure", "should refute" solves the problem. Other ideas like assert with not also work. But, it would be nice to know why the default refute fails.
Expected behavior
Expected dialyzer not to complain to refute macro.
Metadata
Metadata
Assignees
Labels
No labels