mirror of
https://github.com/rgleichman/glance.git
synced 2024-11-30 05:47:46 +03:00
Add pattern unit tests.
This commit is contained in:
parent
f2fd136ac9
commit
ec0bf8adf7
@ -289,6 +289,20 @@ enumTests = TestList [
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
patternTests :: Test
|
||||||
|
patternTests = TestList[
|
||||||
|
-- TODO Remove branch icon
|
||||||
|
assertEqualSyntaxGraphs [
|
||||||
|
"y (F x) = x",
|
||||||
|
"y = (\\(F x) -> x)"
|
||||||
|
]
|
||||||
|
,
|
||||||
|
assertEqualSyntaxGraphs [
|
||||||
|
"y = let {F x y = 3} in x y",
|
||||||
|
"y = let {g = 3; F x y = g} in x y"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
-- Yes, the commas get their own line
|
-- Yes, the commas get their own line
|
||||||
translateUnitTests :: Test
|
translateUnitTests :: Test
|
||||||
translateUnitTests = TestList [
|
translateUnitTests = TestList [
|
||||||
@ -305,6 +319,7 @@ translateUnitTests = TestList [
|
|||||||
, TestLabel "letTests" letTests
|
, TestLabel "letTests" letTests
|
||||||
, TestLabel "negateTests" negateTests
|
, TestLabel "negateTests" negateTests
|
||||||
, TestLabel "enumTests" enumTests
|
, TestLabel "enumTests" enumTests
|
||||||
|
, TestLabel "patternTests" patternTests
|
||||||
]
|
]
|
||||||
|
|
||||||
allUnitTests :: Test
|
allUnitTests :: Test
|
||||||
|
@ -131,19 +131,25 @@ guardTests = [
|
|||||||
patternTests :: [String]
|
patternTests :: [String]
|
||||||
patternTests = [
|
patternTests = [
|
||||||
"Foo _ x = 3",
|
"Foo _ x = 3",
|
||||||
|
|
||||||
|
-- TODO Remove branch icon
|
||||||
"y (F x) = x",
|
"y (F x) = x",
|
||||||
"y = (\\(F x) -> x)",
|
|
||||||
"y = let {g = 3; F x y = h g} in x y",
|
"y = let {g = 3; F x y = h g} in x y",
|
||||||
|
|
||||||
"y = let {F x y = 3} in x y",
|
"y = let {F x y = 3} in x y",
|
||||||
"y = let {g = 3; F x y = g} in x y",
|
|
||||||
"y = let F x y = g in x y",
|
"y = let F x y = g in x y",
|
||||||
|
|
||||||
"F x = g x",
|
"F x = g x",
|
||||||
"Foo (Bar x) (Baz y) = f 1 2 x y",
|
"Foo (Bar x) (Baz y) = f 1 2 x y",
|
||||||
"Foo x y = f 1 y x",
|
"Foo x y = f 1 y x",
|
||||||
|
|
||||||
|
-- TODO Fix so that "t" connects to the apply result, not the pattern.
|
||||||
"t@(x,y) = (x,y)",
|
"t@(x,y) = (x,y)",
|
||||||
"y = let {t@(_,_) = (3,4)} in t + 3",
|
"y = let {t@(_,_) = (3,4)} in t + 3",
|
||||||
|
|
||||||
"y = let {(x, y) = (1,2)} in x + y",
|
"y = let {(x, y) = (1,2)} in x + y",
|
||||||
-- TODO: Fix so that lines between patterns are Pattern Color.
|
|
||||||
"y = let {(x, y) = (1,2); (z, w) = x; (m, g) = y} in foo x y z w m g",
|
"y = let {(x, y) = (1,2); (z, w) = x; (m, g) = y} in foo x y z w m g",
|
||||||
"(x:y) = 2"
|
"(x:y) = 2"
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user