diff options
author | Chimrod <> | 2023-09-23 16:23:54 +0200 |
---|---|---|
committer | Chimrod <> | 2023-09-23 16:23:54 +0200 |
commit | e21c752ccd0d3d73921beddb671aa48429c2dd90 (patch) | |
tree | 0750ea3f269efc57cfbaa48093334483626c9707 /test/qsp_parser_test.ml | |
parent | 557d60d5df5258a29ce964fac1f5ffdc625dcb2a (diff) |
Correction in the parser preseance
Diffstat (limited to 'test/qsp_parser_test.ml')
-rw-r--r-- | test/qsp_parser_test.ml | 21 |
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 ] |