In testing my Phoenix app, I keep running into situations where I'm comparing lists of expected versus actual record IDs. Errors are tedious to interpret because Elixir keeps printing the integer lists as charlists, so my test output looks like:
Assertion with == failed
code: assert H.sort(Enum.map(list1, &(&1.id()))) == H.sort(Enum.map(list2, &(&1.id())))
left: 'stu'
right: 'st'
This is nudging me to rewrite my tests to avoid comparing lists of integers, which is tolerable, but it's a shame to just shrug and look for a workaround in a language like this. So I'm wondering if there's a way to tell Elixir/Mix to always print integer lists as lists, rather than as charlists/charstrings. I write Ruby-styled Elixir and I almost never make use of charlists, to me they're mostly a gotcha to work around.
Thanks to this answer I know there's a way to configure IEx to always print integer lists as lists. Is there a way to do so in Mix, or globally in Elixir itself, so mix test
will adopt that behavior?