|
@@ -988,6 +988,22 @@ let test_local () =
|
|
Tree.Ast.Integer (_position, "12") );
|
|
Tree.Ast.Integer (_position, "12") );
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+let test_local_for () =
|
|
|
|
+ _test_instruction {|for local a = 1 to 10:
|
|
|
|
+end|}
|
|
|
|
+ [
|
|
|
|
+ Tree.Ast.For
|
|
|
|
+ {
|
|
|
|
+ loc = _position;
|
|
|
|
+ variable =
|
|
|
|
+ { Tree.Ast.pos = _position; name = "A"; index = None; local = true };
|
|
|
|
+ start = Tree.Ast.Integer (_position, "1");
|
|
|
|
+ to_ = Tree.Ast.Integer (_position, "10");
|
|
|
|
+ step = None;
|
|
|
|
+ statements = [];
|
|
|
|
+ };
|
|
|
|
+ ]
|
|
|
|
+
|
|
let test =
|
|
let test =
|
|
( "Syntax",
|
|
( "Syntax",
|
|
[
|
|
[
|
|
@@ -1060,4 +1076,5 @@ let test =
|
|
Alcotest.test_case "for ... end" `Quick test_for_end;
|
|
Alcotest.test_case "for ... end" `Quick test_for_end;
|
|
Alcotest.test_case "for step ... end" `Quick test_for_end_with_step;
|
|
Alcotest.test_case "for step ... end" `Quick test_for_end_with_step;
|
|
Alcotest.test_case "local variable" `Quick test_local;
|
|
Alcotest.test_case "local variable" `Quick test_local;
|
|
|
|
+ Alcotest.test_case "local variable in for loop" `Quick test_local_for;
|
|
] )
|
|
] )
|