write-you-a-haskell icon indicating copy to clipboard operation
write-you-a-haskell copied to clipboard

test cases for poly

Open sdiehl opened this issue 10 years ago • 2 comments

Add test cases to test.ml for pathological cases on pull request #40 issue

sdiehl avatar Jan 27 '15 19:01 sdiehl

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).

chsievers avatar Jan 27 '15 22:01 chsievers

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.

sdiehl avatar Jan 28 '15 14:01 sdiehl