|
@@ -882,8 +882,35 @@ let test_stattxt () =
|
|
|
{ Tree.Ast.pos = _position; name = "$STATTXT"; index = None } );
|
|
|
]
|
|
|
|
|
|
-let test_for_end () = _test_instruction {|for a = 1 to 10:
|
|
|
-end|} []
|
|
|
+let test_for_end () =
|
|
|
+ _test_instruction {|for a = 1 to 10:
|
|
|
+end|}
|
|
|
+ [
|
|
|
+ Tree.Ast.For
|
|
|
+ {
|
|
|
+ loc = _position;
|
|
|
+ variable = { Tree.Ast.pos = _position; name = "A"; index = None };
|
|
|
+ start = Tree.Ast.Integer (_position, "1");
|
|
|
+ to_ = Tree.Ast.Integer (_position, "10");
|
|
|
+ step = None;
|
|
|
+ statements = [];
|
|
|
+ };
|
|
|
+ ]
|
|
|
+
|
|
|
+let test_for_end_with_step () =
|
|
|
+ _test_instruction {|for a = 1 to 10 step rnd:
|
|
|
+end|}
|
|
|
+ [
|
|
|
+ Tree.Ast.For
|
|
|
+ {
|
|
|
+ loc = _position;
|
|
|
+ variable = { Tree.Ast.pos = _position; name = "A"; index = None };
|
|
|
+ start = Tree.Ast.Integer (_position, "1");
|
|
|
+ to_ = Tree.Ast.Integer (_position, "10");
|
|
|
+ step = Some (Tree.Ast.Function (_position, T.Rnd, []));
|
|
|
+ statements = [];
|
|
|
+ };
|
|
|
+ ]
|
|
|
|
|
|
let test =
|
|
|
( "Syntax",
|
|
@@ -955,4 +982,5 @@ let test =
|
|
|
Alcotest.test_case "Precedence8" `Quick test_precedence8;
|
|
|
Alcotest.test_case "stattxt" `Quick test_stattxt;
|
|
|
Alcotest.test_case "for ... end" `Quick test_for_end;
|
|
|
+ Alcotest.test_case "for step ... end" `Quick test_for_end_with_step;
|
|
|
] )
|