3 ms·
Tests aren't written to simply assert complex things behave as they should. Tests are also used to enforce certain edge cases (e.g. return nil when the the in
by GorgeRonde 8y ago
Tests aren't written to simply assert complex things behave as they should.
Tests are also used to enforce certain edge cases (e.g. return nil when the the input collection is empty instead of raising an exception), and in this regard allow you to assert stuff your language isn't able to express (because its type system is not as powerful as Haskell for instance).
Tests also allow you to avoid stupid mistakes like using a string instead of a symbol as well.
And anyway, tests are just a way to durably persist the testing that is always done by a programmer, be it in a REPL or with the few lines of codes at the end of a file used in the writing of code.