James_E
I see that the current ExUnit source code has support for rich failure messages on a small whitelist of “recognized” assertion patterns, namely:
assert match?(left, right),assert left = rightrefute match?(left, right),refute left = rightassert left === right,refute left !== right,assert left !== right,refute left === right,assert left == right,refute left != right,assert left != right,refute left == right,assert left >= right,refute left < right,assert left > right,refute left <= rightassert left <= right,refute left > rightassert left < right,refute left >= rightassert left ~= rightrefute left ~= right
Would there be any interest in a pull request adding support for an additional pattern:
refute left and not right(implication, right must be true whenever left is)
This pattern is coming up repeatedly as the most robust, developer-intent-communicating form for some unittests I’m writing:
property "delete returns a well-formed multiset whenever input is well-formed" do
check all ms <- t(term(), strict: false),
value <- term(),
count <- one_of([non_negative_integer(), constant(:all)]) do
result = One9.Ms.delete(ms, value, count)
refute One9.Ms.well_formed?(ms) and not One9.Ms.well_formed?(result)
end
end
property "put 0 copies doesn't corrupt struct" do
check all multiset <- t(term()), value <- term() do
result = One9.Multiset.put(multiset, value, 0)
assert One9.Ms.well_formed?(result.counts)
assert One9.Multiset.equals?(result, multiset)
refute One9.Multiset.member?(result, value) and not One9.Multiset.member?(multiset, value)
end
end
And having these tests augmented with a little bit of extra verbiage and awesome debug formatting, like the comparison checks currently have, would be a minor boon.
Trending in Discussions
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hi there! :wave:
@frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










First Post!- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
tfwright
Personally, I think the most important value for test cases is simplicity, so I’m definitely skeptical about support for something like this.
FWIW, about the first example specifically I would argue that you should not be writing assertions against test inputs since they are supposed to be known. Granted I’m not familiar with the DSL shown so maybe I’m misunderstanding something but generally I would only expect the second part of that assertion to be a meaningful test since the former would be testing the test itself.
Most Liked
fuelen
When guards are failing, boolean logic is highlighted with colours. I don’t see any reason why it shouldn’t be supported in ExUnit as well.
As @christhekeele has already suggested, please start a discussion on the core mailing list.
christhekeele
This seems like a reasonable conversation to start on the core mailing list, if you can’t find a prior discussion.
I think property-based testing and other test design philosophy is orthogonal to this discussion: