aboutsummaryrefslogtreecommitdiff
path: root/test/syntax.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/syntax.ml')
-rw-r--r--test/syntax.ml17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/syntax.ml b/test/syntax.ml
index f64129f..3b7c2f9 100644
--- a/test/syntax.ml
+++ b/test/syntax.ml
@@ -596,7 +596,7 @@ let test_if_inline_act () =
let test_if_multiline () =
_test_instruction {|if 1 _
- and hour >= 8: 1|}
+ and _hour >= 8: 1|}
[
Ast.If
{
@@ -611,7 +611,7 @@ let test_if_multiline () =
( _position,
Qsp_syntax.T.Gte,
Ast.Ident
- { Ast.pos = _position; name = "HOUR"; index = None },
+ { Ast.pos = _position; name = "_HOUR"; index = None },
Ast.Integer (_position, "8") ) ),
[ Tree.Ast.Expression (Tree.Ast.Integer (_position, "1")) ] );
elifs = [];
@@ -884,6 +884,18 @@ let minus_operator () =
Tree.Ast.Integer (_position, "7") ));
]
+(** STATTXT was considered as a function and raised an error in the syntax *)
+let test_stattxt () =
+ _test_instruction "$value = $stattxt"
+ [
+ Tree.Ast.Declaration
+ ( _position,
+ { Tree.Ast.pos = _position; name = "$VALUE"; index = None },
+ T.Eq',
+ Tree.Ast.Ident
+ { Tree.Ast.pos = _position; name = "$STATTXT"; index = None } );
+ ]
+
let test =
( "Syntax",
[
@@ -952,4 +964,5 @@ let test =
Alcotest.test_case "inline if else if" `Quick test_mutiple_inline_ifs;
Alcotest.test_case "Precedence7" `Quick test_precedence7;
Alcotest.test_case "Precedence8" `Quick test_precedence8;
+ Alcotest.test_case "stattxt" `Quick test_stattxt;
] )