Show custom assertion message besides what `assert` already shows

Sometimes, I have tests like this

checks = %{
“filter1” => :result1
“filter2” => :result2

Enum.each(checks, fn {filter, result} ->
# do something and assert
assert a == b, “Filter #{filter} failed”

This is specially useful for testing API endpoints, where you can do some filtering/sorting/… and write them all in one test and assert result.

The problem is the assertion message. When an assertion fails here, it doesn’t show the diff of values as it normally does, it just writes “Filter filter1 failed” and that’s it.

Is there a way I can make it show my custom message, while also showing the value diffs?

not in current implementation, as assert/2 is implemented as a function, not as a macro.