write-you-a-haskell
write-you-a-haskell copied to clipboard
test cases for poly
Add test cases to test.ml
for pathological cases on pull request #40 issue
I'd rather call them non-trivial.
The example
\f n -> if True then n else (f (n+1))
is just a trimmed down version of the useful function
let rec findfrom p n = if (p n) then n else (findfrom p (n+1))
I'd preserve "pathological" for cases like
let c x y = if True then x else y
c(c(c(c(c(c(c(c(c c))))))))
(which always worked).
That's fair, I'll start doing what GHC does and add a should_fail
and should_pass
folder for the failure cases. 53f1e5c
So now to test for regressions, it's just:
$ poly test test/should_fail/test_if.ml
For the more complicated ProtoHaskell compiler, I already use the tasty golden test runner. But it's a little heavy for these little toy language though.