diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-09-02 12:57:29 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-09-02 12:57:29 +0100 |
commit | f66874f1f5066e57ef5761cd7c87b5d498fd89b6 (patch) | |
tree | 0edef26cda608a79c92f9c64c847f214ba877f9c /test/Language.hs | |
parent | a5633563e9bb579ed10cb7d6d43676485c13b1fb (diff) | |
download | micro-lang-hs-f66874f1f5066e57ef5761cd7c87b5d498fd89b6.tar.gz micro-lang-hs-f66874f1f5066e57ef5761cd7c87b5d498fd89b6.zip |
Private variables
Diffstat (limited to 'test/Language.hs')
-rw-r--r-- | test/Language.hs | 21 |
1 files changed, 16 insertions, 5 deletions
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, |