aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/ocaml/exception_order_runme.ml
blob: 9e987c84b23fb35f770a9476d8348a9f20893170 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
open Swig
open Exception_order

let a = new_A '()

let check meth args expected =
  try
    ignore ((invoke a) meth (args)); assert false
  with Failure msg -> assert (msg = expected)

let _ =
  check "foo" '() "C++ E1 exception thrown";
  check "bar" '() "C++ E2 exception thrown";
  check "foobar" '() "postcatch unknown";
  check "barfoo" (C_int 1) "C++ E1 exception thrown";
  check "barfoo" (C_int 2) "C++ E2 * exception thrown";
;;