devonestes / assertions

Helpful assertions for ExUnit
MIT License
142 stars 29 forks source link

Symmetrical functions (refutes) #10

Closed icehaunter closed 4 years ago

icehaunter commented 4 years ago

I think it would be great, it there would exist complimentary functions in the library: for example, today I encountered a need to refute that the struct is present in a list :)

devonestes commented 4 years ago

What would you expect out of a failure message from that assertion? The big reason I created this library was to create some really great failure messages, but I can't think of any improvement over what we already have for these cases.

icehaunter commented 4 years ago

Failure message could be (in case of struct in list) that the struct is present in the list, and output of that struct, maybe with highlights of the keys by which the equality was asserted

devonestes commented 4 years ago

I’m not totally sold on that... like, what value is there in seeing the keys that were used, since we should already know the keys that were used? I might still be missing it, but I’m not sure how that information would help me find and fix my bug anymore than the output of ‘refute Enum.any?(...)’.

icehaunter commented 4 years ago

OK, I concede that good failure message is not obvious.

Main reason I created this request, was to use the same pattern of assertions for both asserts and refutes. If you think that those are not needed, then lets close the issue, I understand the reasoning :)