Support where clauses, let bindings and case expressions in case splitting (fixes #395)
This commit is contained in:
committed by
Daniel Gröber
parent
833d9ce058
commit
56cc237e26
@@ -18,3 +18,24 @@ spec = do
|
||||
res `shouldBe` "24 1 24 30"++
|
||||
" \"mlAppend Nil y = _mlAppend_body\NUL"++
|
||||
"mlAppend (Cons x1 x2) y = _mlAppend_body\"\n"
|
||||
|
||||
it "works with case expressions" $ do
|
||||
withDirectory_ "test/data/case-split" $ do
|
||||
res <- runD $ splits "Vect.hs" 28 20
|
||||
res `shouldBe` "28 19 28 39"++
|
||||
" \"Nil -> _mlAppend_body\NUL"++
|
||||
" (Cons x'1 x'2) -> _mlAppend_body\"\n"
|
||||
|
||||
it "works with where clauses" $ do
|
||||
withDirectory_ "test/data/case-split" $ do
|
||||
res <- runD $ splits "Vect.hs" 34 17
|
||||
res `shouldBe` "34 5 34 43"++
|
||||
" \"mlReverse' Nil accum = _mlReverse_body\NUL"++
|
||||
" mlReverse' (Cons xs'1 xs'2) accum = _mlReverse_body\"\n"
|
||||
|
||||
it "works with let bindings" $ do
|
||||
withDirectory_ "test/data/case-split" $ do
|
||||
res <- runD $ splits "Vect.hs" 38 33
|
||||
res `shouldBe` "38 21 38 59"++
|
||||
" \"mlReverse' Nil accum = _mlReverse_body\NUL"++
|
||||
" mlReverse' (Cons xs'1 xs'2) accum = _mlReverse_body\"\n"
|
||||
|
||||
@@ -22,3 +22,18 @@ data MyList a = Nil | Cons a (MyList a)
|
||||
|
||||
mlAppend :: MyList a -> MyList a -> MyList a
|
||||
mlAppend x y = _mlAppend_body
|
||||
|
||||
mlAppend2 :: MyList a -> MyList a -> MyList a
|
||||
mlAppend2 x y = case x of
|
||||
x' -> _mlAppend_body
|
||||
|
||||
mlReverse :: MyList a -> MyList a
|
||||
mlReverse xs = mlReverse' xs Nil
|
||||
where
|
||||
mlReverse' :: MyList a -> MyList a -> MyList a
|
||||
mlReverse' xs' accum = _mlReverse_body
|
||||
|
||||
mlReverse2 :: MyList a -> MyList a
|
||||
mlReverse2 xs = let mlReverse' :: MyList a -> MyList a -> MyList a
|
||||
mlReverse' xs' accum = _mlReverse_body
|
||||
in mlReverse' xs Nil
|
||||
|
||||
Reference in New Issue
Block a user