aboutsummaryrefslogtreecommitdiff
path: root/test/qsp_parser_test.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/qsp_parser_test.ml')
-rw-r--r--test/qsp_parser_test.ml21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/qsp_parser_test.ml b/test/qsp_parser_test.ml
index ef19ed9..6ac8bfa 100644
--- a/test/qsp_parser_test.ml
+++ b/test/qsp_parser_test.ml
@@ -1,4 +1,5 @@
module Parser = Qsp_parser.Parser.Make (Qsp_syntax.Tree)
+module Tree = Qsp_syntax.Tree
module Ast = Qsp_syntax.Tree.Ast
module T = Ast
@@ -594,7 +595,7 @@ let test_gt () =
Ast.Ident
{
Ast.pos = _position;
- name = "CURLOC";
+ name = "$CURLOC";
index = Some (Ast.Integer (_position, "0"));
};
] );
@@ -682,6 +683,23 @@ let test_dyneval () =
(Ast.Function (_position, Dyneval, [ Ast.Literal (_position, "") ]));
]
+(** The parens after input are considered as arguments for the function, not a
+ following expression.
+
+ This expression is a boolean.
+*)
+let test_input () =
+ _test_instruction "( input('') = '' )"
+ [
+ Tree.Ast.Expression
+ (Tree.Ast.BinaryOp
+ ( _position,
+ Eq,
+ Tree.Ast.Function
+ (_position, Input, [ Tree.Ast.Literal (_position, "") ]),
+ Tree.Ast.Literal (_position, "") ));
+ ]
+
let syntax =
( "Syntax",
[
@@ -742,6 +760,7 @@ let syntax =
Alcotest.test_case "Operator" `Quick test_operator;
Alcotest.test_case "Operator2" `Quick test_operator2;
Alcotest.test_case "Dyneval" `Quick test_dyneval;
+ Alcotest.test_case "Input" `Quick test_input;
] )
let () = Alcotest.run "qsp_parser" [ syntax ]