by skrishnamurthi · 13y ago · 0 comments
Nevertheless, perhaps you could provide some pointers to the "many" projects that have tried it before?
Assertions are not tests. This is a fundamental misunderstanding of the difference.
Pyret's `check` blocks exist to write complex tests, separate tests from definitions, or write tests that cross multiple functional units. So they offer the power of regular testing frameworks.
Thus, `where` is the bonus, not a "compromise".
Beyond that, I'd agree completely. Doctests, for instance, are quite terrible when you can't fit all of the logic into one line, but then I think it's usually a sign of a well-designed function when it's good a good enough interface to get a few pithy doctests in.
(Another virtue of test blocks: you can write little local helper functions. There's an example of this on the Pyret home page.)
-- | Documentation goes here
--
-- > 2 + 2 == 4
-- True
--
-- prop> \lst -> reverse (reverse lst) == lstHmm...Jane Street?