|
|
|
|
|
by dnautics
1931 days ago
|
|
Elixir/ecto has something called schema changesets that are a very robust way of validating user input. I do test against bad values (not just types, out of range, correct type but unsupported value, etc), but only really at data ingress, and no where else. Honestly if a sad path causes a typing error in elixir it's not the worst thing. Sentry will catch it, only the user thread crashes, and you go patch it later. |
|
A type is literally a description of a set of valid values. So when you say you test with bad values, then the answer is: you could use types and would not need these tests anymore.
However, the more interesting question is: is your typesystem capable of expressing your type and, if so, is it worth the effort and implications to do so.
But on a more theoretical level, OP is right: you _can_ save the tests with, given a powerful enough typesystem.