; code : string
; out_lexing : (Tiger_parser.token list) option
; out_parsing : Tiger_absyn.t option
+ ; is_error_expected_parsing : (Tiger_error.t -> bool) option
; is_error_expected_semant : (Tiger_error.t -> bool) option
}
let case
?(out_lexing=None)
?(out_parsing=None)
+ ?(is_error_expected_parsing=None)
?(is_error_expected_semant=None)
~code
name
; code
; out_lexing
; out_parsing
+ ; is_error_expected_parsing
; is_error_expected_semant
}
; code
; out_lexing
; out_parsing
+ ; is_error_expected_parsing
; is_error_expected_semant
}
->
run_pass
~f:(fun () -> pass_parsing ~fake_filename:name ~code)
~expect_output:out_parsing
- ~is_error_expected:None
+ ~is_error_expected:is_error_expected_parsing
in
let res_sem =
run_pass
val case
: ?out_lexing : Tiger_parser.token list option
-> ?out_parsing : Tiger_absyn.t option
+ -> ?is_error_expected_parsing : (Tiger_error.t -> bool) option
-> ?is_error_expected_semant : (Tiger_error.t -> bool) option
-> code : string
-> string
(* TODO: Fill-in expected cases *)
None
+let is_error_expected_parsing_of_filename =
+ let module E = Tiger_error in
+ function
+ | "test49.tig" ->
+ Some (function E.Invalid_syntax _ -> true | _ -> false)
+ (* TODO: Be more specific - test position *)
+ | _ ->
+ (* TODO: Fill-in other expected cases *)
+ None
+
let is_error_expected_semant_of_filename _ =
(* TODO: Fill-in expected cases *)
None
~code:(read_file (Filename.concat dir filename))
~out_lexing:(out_lexing_of_filename filename)
~out_parsing:(out_parsing_of_filename filename)
+ ~is_error_expected_parsing:(is_error_expected_parsing_of_filename filename)
~is_error_expected_semant:(is_error_expected_semant_of_filename filename)
let read ~from_dir:dir =