blob: 634ef4a5b7a0814ac4d73df6e69d2be5324dcb7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
(* TEST
expect;
*)
(* PR#8594 *)
Printexc.register_printer (fun e ->
match e with
| Division_by_zero -> Some "A division by zero is undefined"
| _ -> None);;
[%%expect{|
- : unit = ()
|}];;
Printexc.register_printer (fun e ->
match e with
| Exit -> Some "Catching an exit"
| _ -> None);;
[%%expect{|
- : unit = ()
|}];;
raise Not_found;;
[%%expect{|
Exception: Not_found.
|}];;
raise Exit;;
[%%expect{|
Exception: Catching an exit
|}];;
exception Foo of string;;
[%%expect {|
exception Foo of string
|}];;
raise (Foo "bar");;
[%%expect {|
Exception: Foo "bar".
|}];;
raise Division_by_zero;;
[%%expect {|
Exception: A division by zero is undefined
|}];;
|