News for hackers. Stuff that matters.
Re:Unit Tests as Documentation by tmoertel on Thursday October 17, 2024 @08:14PM (#41875148)
In some cases, unit tests can both test and specify the semantics of the system being tested. My favorite example is the ReadP parsing library for Haskell. The source code ends with a short and automatically testable specification of the semantics of the combinators that make up the library. So, in this example, the tests tell you almost everything you need to know about the library.

https://hackage.haskell.org/package/ghc-internal-9.1001.0/do...

There are no comments on this comment yet.