From f66874f1f5066e57ef5761cd7c87b5d498fd89b6 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Fri, 2 Sep 2022 12:57:29 +0100 Subject: Private variables --- test/Language.hs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'test/Language.hs') diff --git a/test/Language.hs b/test/Language.hs index fbb9c3b..19ec5bf 100644 --- a/test/Language.hs +++ b/test/Language.hs @@ -64,7 +64,7 @@ testCase4 = "module main\n\ \def fn(a: u8) { }" [ A.Module "main" $ newPos "test" 1 1, - A.Func "fn" [("a", A.Type "u8", newPos "test" 2 8)] Nothing [] False False $ newPos "test" 2 1 + A.Func "fn" [("a", A.Type "u8", True, newPos "test" 2 8)] Nothing [] False False $ newPos "test" 2 1 ] testCase5 = @@ -101,7 +101,7 @@ testCase7 = \def fn(a: u8) { }\n\ \fn(10);" [ A.Module "main" $ newPos "test" 1 1, - A.Func "fn" [("a", A.Type "u8", newPos "test" 2 8)] Nothing [] False False $ newPos "test" 2 1, + A.Func "fn" [("a", A.Type "u8", True, newPos "test" 2 8)] Nothing [] False False $ newPos "test" 2 1, A.Call (A.Variable "fn" $ newPos "test" 3 1) [A.Num 10 $ newPos "test" 3 4] $ newPos "test" 3 1 ] @@ -143,7 +143,7 @@ testCase10 = A.Func "fn1" [] Nothing [] False False $ newPos "test" 2 1, A.Func "fn2" - [("f", A.FuncType [] Nothing, newPos "test" 3 9)] + [("f", A.FuncType [] Nothing, True, newPos "test" 3 9)] Nothing [ A.Call (A.Variable "f" $ newPos "test" 4 1) [] $ newPos "test" 4 1 ] @@ -165,7 +165,7 @@ testCase11 = [ A.Module "main" $ newPos "test" 1 1, A.Func "fn" - [("f", A.FuncType [] Nothing, newPos "test" 2 8)] + [("f", A.FuncType [] Nothing, True, newPos "test" 2 8)] Nothing [A.Call (A.Variable "f" $ newPos "test" 3 1) [] $ newPos "test" 3 1] False @@ -191,7 +191,17 @@ testCase13 = "module main\n\ \var a: u8 = 10;" [ A.Module "main" $ newPos "test" 1 1, - A.Var "a" (A.Type "u8") (A.Num 10 $ newPos "test" 2 13) $ newPos "test" 2 5 + A.Var "a" (A.Type "u8") (A.Num 10 $ newPos "test" 2 13) False $ newPos "test" 2 5 + ] + +testCase14 = + TestLabel "parse a private variable declaration" $ + TestCase $ + assertAst + "module main\n\ + \private var a: u8 = 10;" + [ A.Module "main" $ newPos "test" 1 1, + A.Var "a" (A.Type "u8") (A.Num 10 $ newPos "test" 2 21) True $ newPos "test" 2 13 ] -- test errors @@ -312,6 +322,7 @@ language = testCase11, testCase12, testCase13, + testCase14, testCaseE1, testCaseE2, testCaseE3, -- cgit v1.2.3