diff options
author | Chimrod <> | 2024-12-14 23:06:12 +0100 |
---|---|---|
committer | Chimrod <> | 2025-01-03 15:05:00 +0100 |
commit | 75f3eabb46eded01460f7700a75d094100047438 (patch) | |
tree | 4dcee7d2fc9310ff41776d9df8986f5efa0db229 /test/make_checkTest.ml | |
parent | 289dc576624d4233116806e566bb791fee1de178 (diff) |
Diffstat (limited to 'test/make_checkTest.ml')
-rw-r--r-- | test/make_checkTest.ml | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/test/make_checkTest.ml b/test/make_checkTest.ml index d3ad358..a863214 100644 --- a/test/make_checkTest.ml +++ b/test/make_checkTest.ml @@ -23,42 +23,42 @@ module M (Check : Qsp_syntax.S.Analyzer) = struct @@ Alcotest.pair Alcotest.string (Alcotest.testable Qsp_syntax.Report.pp equal) - let parse : + let _parse : ?context:Check.context -> + Qparser.Analyzer.lexer -> string -> (Check.Location.t Qparser.Analyzer.result, t) result = - fun ?context content -> + fun ?context lexer content -> let lexing = Sedlexing.Latin1.from_string content |> Qparser.Lexbuf.from_lexbuf in let context = Option.value context ~default:(Check.initialize ()) in - Qparser.Analyzer.parse (module Check) lexing context + Qparser.Analyzer.parse (module Check) lexer lexing context let get_report : (Check.Location.t Qparser.Analyzer.result, Qsp_syntax.Report.t) result -> Qsp_syntax.Report.t list = function | Ok v -> v.report - | Error _ -> failwith "Error" + | Error msg -> failwith msg.message let _test_instruction : string -> t list -> unit = fun literal expected -> - let _location = Printf.sprintf {|# Location -%s -------- |} literal in - let actual = get_report @@ parse _location and msg = literal in + let actual = get_report @@ _parse Qparser.Analyzer.Dynamic literal + and msg = literal in Alcotest.(check' report ~msg ~expected ~actual) - (** Run a test over the whole file. - The parsing of the content shall not report any error. - *) + (** Run a test over the whole file. The parsing of the content shall not + report any error. *) let global_check : string -> (string * t) list -> unit = fun literal expected -> let _location = Printf.sprintf {|# Location %s ------- |} literal in let context = Check.initialize () in - let actual = get_report @@ parse ~context _location in + let actual = + get_report @@ _parse ~context Qparser.Analyzer.Location _location + in let () = Alcotest.( check' report ~msg:"Error reported during parsing" ~expected:[] ~actual) |