diff options
Diffstat (limited to 'test/qsp_parser_test.ml')
-rw-r--r-- | test/qsp_parser_test.ml | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/qsp_parser_test.ml b/test/qsp_parser_test.ml index b833fe5..6bf249d 100644 --- a/test/qsp_parser_test.ml +++ b/test/qsp_parser_test.ml @@ -7,10 +7,16 @@ let _position = (Lexing.dummy_pos, Lexing.dummy_pos) type 'a location = 'a * 'a Ast.statement list [@@deriving eq, show] +(** Run the parser with the given expression and return the result *) let parse : string -> T.pos location = fun content -> - let lexing = Lexing.from_string content in - Parser.main Qparser.Lexer.token lexing + let lexing = Sedlexing.Latin1.from_string content in + + match Qparser.Analyzer.parse (module Qsp_syntax.Tree) lexing with + | Ok e -> e + | Error e -> + let msg = Format.asprintf "%a" Qparser.Analyzer.format_error e in + raise (Failure msg) let location : T.pos location Alcotest.testable = let equal = equal_location (fun _ _ -> true) in |