diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-09-06 12:10:57 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-09-06 12:10:57 +0100 |
commit | 67967f029305c663fb3fbb4e0f1a6e375f5d572c (patch) | |
tree | b4ebdf48e7676a621f72fdc7f0b6c90cbc498639 /test/Language.hs | |
parent | 22db8bbbd85028f19eaef5fec70c12f7706771b1 (diff) | |
download | micro-lang-hs-67967f029305c663fb3fbb4e0f1a6e375f5d572c.tar.gz micro-lang-hs-67967f029305c663fb3fbb4e0f1a6e375f5d572c.zip |
Group variable declaration
Diffstat (limited to 'test/Language.hs')
-rw-r--r-- | test/Language.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Language.hs b/test/Language.hs index 84c72ae..5c1bb57 100644 --- a/test/Language.hs +++ b/test/Language.hs @@ -204,6 +204,30 @@ testCase14 = A.Var "a" (A.Type "u8") (A.Num 10 $ newPos "test" 2 21) True $ newPos "test" 2 13 ] +testCase15 = + TestLabel "parse a group variable declaration" $ + TestCase $ + assertAst + "module main\n\ + \var (a: u8 = 10,\n\ + \b: bool = true);" + [ A.Module "main" $ newPos "test" 1 1, + A.Var "a" (A.Type "u8") (A.Num 10 $ newPos "test" 2 14) False $ newPos "test" 2 6, + A.Var "b" (A.Type "bool") (A.Bool' True $ newPos "test" 3 11) False $ newPos "test" 3 1 + ] + +testCase16 = + TestLabel "parse a group of private variable declaration" $ + TestCase $ + assertAst + "module main\n\ + \private var (a: u8 = 10,\n\ + \b: bool = true);" + [ A.Module "main" $ newPos "test" 1 1, + A.Var "a" (A.Type "u8") (A.Num 10 $ newPos "test" 2 22) True $ newPos "test" 2 14, + A.Var "b" (A.Type "bool") (A.Bool' True $ newPos "test" 3 11) True $ newPos "test" 3 1 + ] + -- test errors testCaseE1 = @@ -339,6 +363,9 @@ language = testCase12, testCase13, testCase14, + testCase15, + testCase16, + -- errors testCaseE1, testCaseE2, testCaseE3, |