From e21c752ccd0d3d73921beddb671aa48429c2dd90 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Sat, 23 Sep 2023 16:23:54 +0200 Subject: Correction in the parser preseance --- test/qsp_parser_test.ml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test/qsp_parser_test.ml') 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 ] -- cgit v1.2.3