diff options
Diffstat (limited to 'test/syntax.ml')
| -rw-r--r-- | test/syntax.ml | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/test/syntax.ml b/test/syntax.ml index ce3e89e..64c5004 100644 --- a/test/syntax.ml +++ b/test/syntax.ml @@ -33,10 +33,10 @@ let parse : string -> (S.pos location, Qsp_syntax.Report.t) result = (module Parser) Qparser.Analyzer.Location lexing context |> Result.map (fun v -> - (* Uncatched excteptions here, but we are in the tests… + (* Uncatched excteptions here, but we are in the tests… If it’s fail here I have an error in the code. *) - Array.get v.Qparser.Analyzer.content 0 - |> Check.get location_id |> Option.get) + Array.get v.Qparser.Analyzer.content 0 + |> Check.get location_id |> Option.get) let location : S.pos location Alcotest.testable = let equal = equal_location (fun _ _ -> true) in @@ -895,8 +895,21 @@ let test_stattxt () = { Tree.Ast.pos = _position; name = "$STATTXT"; index = None } ); ] +let test_function_no_args () = + let expected = + [ + Tree.Ast.Declaration + ( _position, + { Tree.Ast.pos = _position; name = "VALUE"; index = None }, + T.Eq', + Tree.Ast.Function (_position, T.Msecscount, []) ); + ] + in + _test_instruction "value = msecscount" expected; + _test_instruction "value = msecscount()" expected + let test_syntax = - ( "Syntax", + ( __FILE__, [ Alcotest.test_case "Location" `Quick test_empty_location; Alcotest.test_case "Location" `Quick test_location_without_space; @@ -957,6 +970,7 @@ let test_syntax = Alcotest.test_case "Precedence7" `Quick test_precedence7; Alcotest.test_case "Precedence8" `Quick test_precedence8; Alcotest.test_case "stattxt" `Quick test_stattxt; + Alcotest.test_case "stattxt" `Quick test_function_no_args; ] ) let test_comments = |
