blob: a6c3d8122e9d3e9639ca700a69635d302ad20a17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
(* TEST
*)
(**
Test that value match failure in a match block raises Match_failure.
*)
let return_some_3 () = Some (1 + 2)
;;
let test_match_partial_match =
try
let _ = (match return_some_3 () with
| Some x when x < 3 -> "Some x"
| exception Failure _ -> "failure"
| exception Invalid_argument _ -> "invalid argument"
| None -> "None"
) [@ocaml.warning "-8"] in
assert false
with
Match_failure _ ->
print_endline "match failure, as expected"
;;
|