From 8e2c6fd083fdc6603a34da06f323792eb9d47b12 Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Tue, 15 Mar 2016 23:33:28 +0300 Subject: [PATCH] Testcase for case-split crash --- test/CaseSplitSpec.hs | 5 +++++ test/data/case-split/Crash.hs | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 test/data/case-split/Crash.hs diff --git a/test/CaseSplitSpec.hs b/test/CaseSplitSpec.hs index 5e5db3f..4cec78b 100644 --- a/test/CaseSplitSpec.hs +++ b/test/CaseSplitSpec.hs @@ -39,3 +39,8 @@ spec = do res `shouldBe` "38 21 38 59"++ " \"mlReverse' Nil accum = _mlReverse_body\NUL"++ " mlReverse' (Cons xs'1 xs'2) accum = _mlReverse_body\"\n" + + it "doesn't crash when source doesn't make sense" $ + withDirectory_ "test/data/case-split" $ do + res <- runD $ splits "Crash.hs" 4 6 + res `shouldBe` [] diff --git a/test/data/case-split/Crash.hs b/test/data/case-split/Crash.hs new file mode 100644 index 0000000..7ee88cb --- /dev/null +++ b/test/data/case-split/Crash.hs @@ -0,0 +1,4 @@ +module Crash where + +test :: Maybe a +test x = undefined