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?
It's been tried many times before and it has always failed. A few reasons:
- It clutters the code
- If you need simple tests, asserts suffice
- If you need more sophisticated tests, write functional tests, separately
The approach offered by Pyret (along with similar ones, such as design by contract) are compromises that are the worst of both worlds.