From 67967f029305c663fb3fbb4e0f1a6e375f5d572c Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Tue, 6 Sep 2022 12:10:57 +0100 Subject: Group variable declaration --- test/Language.hs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/Language.hs') 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, -- cgit v1.2.3