diff options
Diffstat (limited to 'test/ocaml/trycatch')
| -rw-r--r-- | test/ocaml/trycatch/expect | 2 | ||||
| -rw-r--r-- | test/ocaml/trycatch/tc.sail | 23 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/ocaml/trycatch/expect b/test/ocaml/trycatch/expect new file mode 100644 index 00000000..0aab34df --- /dev/null +++ b/test/ocaml/trycatch/expect @@ -0,0 +1,2 @@ +Before throw +Caught! diff --git a/test/ocaml/trycatch/tc.sail b/test/ocaml/trycatch/tc.sail new file mode 100644 index 00000000..b805f3fa --- /dev/null +++ b/test/ocaml/trycatch/tc.sail @@ -0,0 +1,23 @@ + +scattered union exception + +union clause exception = Test_int : int + +union clause exception = Test_failure : string + +val main : unit -> unit effect {escape} + +function main () = { + try { + print("Before throw"); + throw(Test_failure("Caught!")); + print("Not printed") + } catch { + Test_failure(msg) => print(msg), + _ => print("Unknown exception") + } +} + +union clause exception = Test_other + +end exception
\ No newline at end of file |
