let module E = Tiger_error in
function
| "test49.tig" ->
- Some (function E.Invalid_syntax _ -> true | _ -> false)
+ Some Error.is_invalid_syntax
(* TODO: Be more specific - test position *)
| _ ->
(* TODO: Fill-in other expected cases *)
None
+(* TODO test21.tig - error : procedure returns value and procedure is used in arexpr *)
+(* TODO test22.tig - No_such_field_in_record *)
+(* TODO test24.tig - Exp_not_an_array *)
+(* TODO test25.tig - Exp_not_a_record *)
+
let is_error_expected_semant_of_filename =
let module E = Tiger_error in
function
+ | "test17.tig" ->
+ Some Error.is_unknown_type
+ (* TODO: Be more specific - which type? *)
+ | "test09.tig"
+ | "test11.tig"
+ | "test13.tig"
+ | "test14.tig"
+ | "test23.tig"
+ | "test26.tig"
+ | "test28.tig"
+ | "test29.tig"
+ | "test31.tig"
+ | "test32.tig"
+ | "test34.tig"
| "test43.tig" ->
Some Error.is_wrong_type
(* TODO: Be more specific - what expected, what given? *)
~is_error_expected_parsing:(is_error_expected_parsing_of_filename filename)
~is_error_expected_semant:(is_error_expected_semant_of_filename filename)
+let is_filename_starts_with_dot filename =
+ match filename.[0] with
+ | exception Invalid_argument _ ->
+ (* Filename should not be an empty string *)
+ assert false
+ | '.' -> true
+ | _ -> false
+
+let is_filename_not_hidden filename =
+ not (is_filename_starts_with_dot filename)
+
let read ~from_dir:dir =
Sys.readdir dir
|> Array.to_list
+ |> List.filter ~f:is_filename_not_hidden
|> List.sort ~cmp:compare
|> List.map ~f:(test_case_of_filename ~dir)