3 ms·
> Types are no substitute for testing. I don't agree with the person you're replying to that types make tests redundant, but to claim that types can't substitu
by mixedCase 7y ago
> Types are no substitute for testing.
I don't agree with the person you're replying to that types make tests redundant, but to claim that types can't substitute a large amount of testing can only come from inexperience.
Whatever property you can model successfully through a closed type, is a property you never have to test ever again anywhere it's being used. If you have 500 functions that take a NonEmptyString, those are 499 fewer property checks in tests (because you should have one test for the type constructor).
- lucisferre 7y ago> types can't substitute a large amount of testing can only come from inexperience That is a very bold assertion I have seen no evidence for. I write very few tests in Ruby or Javascript aimed at validating types.