So, we have the assert/1 macro in ExUnit, which does a really nice job of
pointing out actual failures - a diff, etc, depending on what you give it.
We also have assert/2, a function where you can insert your own message. I
propose that we have perhaps another option: a variant of assert(assertion,
contextual_data: %{foo: "bar"}). Basically, I love that diffing we do in
assert/1, and just want to append some relevant data to the message, which
is particularly helpful if I'm running an assertion in a loop (think poor
man's property-based testing) with different data -- the line number isn't
going to allow me enough data to figure out what exactly just failed.
I understand it wouldn't be trivial to do, pretty much because there's
already an assert/2 with opts and with message, and they're functions not
macros...
Sorry if I'm missing anything about proposals - this is my first one!
I'm willing to maybe put some time into a PR here, if the feedback is
positive and has a bit of guidance (Elixir is my day-job, so I do have some
experience)
Thanks,
Derek
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/elixir-lang-core/03dfc4c0-81f8-4317-ae88-4ea9d00e0464n%40googlegroups.com.