20
Baby unit tests
(johan.hal.se)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
Types aren't unit tests. Unit tests only test a discrete set of inputs and outputs for correctness, and can miss cases that aren't tested for.
In sound type systems, they are closer to formal verification. The compiler guarantees the properties you expect of the type hold.
As for the rest of the article, do what works best for you in your projects, but if I need to work with you, I'm going to ask for types. I need to know what types the interface expects to receive. Names are not enough. Document them, use type hints, whatever, just put them somewhere because I'm not psychic and I don't know what you thought about when writing the function.