Open lboekhorst opened 7 years ago
Works for me with IEx 1.5.0
:
root@localhost(@)> iex --version
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
IEx 1.5.0
Mon Oct 16 09:50:24
~/quixir
root@localhost(@)> mix test
.............
Finished in 0.4 seconds
13 tests, 0 failures
Randomized with seed 134644
Mon Oct 16 09:50:38
~/quixir
Please try upgrading elixir to the latest stable version.
First off, my environment is as follows:
I am testing that a field on my struct is only valid when it is a list where all values are between one and seven:
I purposely set
max
to eight to test that it fails and provides the proper failing list. It seems it doesn't however. The first example this test case generates is:This list includes eights so it properly concludes the changeset is not valid. Then it will try to shrink it down to the smallest possible failing test case:
What you are looking at is the result of the shrinked list, and the result from
changeset.valid?
given that list. Up until the final example the list is still invalid since it contains an eight. The final list no longer includes an eight and thus is valid. However, at this point, quixir will stop shrinking and output the following:This is incorrect, this is the first test case that is passing for a valid reason. Am I overlooking something here? How can I get it to properly report the failing test case? I would also be ok with an option to disable shrinking (since this seems to be the cause) altogether as a quick workaround.