swig/Examples/test-suite/ocaml/exception_order_runme.ml
Zackery Spytz 071803f000 [OCaml] Fix segfaults when too few arguments are passed to a function
Prevent segfaults when too few arguments are passed to a function.

Length checks are not needed for the wrappers of overloaded
functions -- the generated dispatch function already checks.

Add default_args_runme.ml.

Fix minor errors in some runtime tests.  Extra args were being passed
in some cases.
2019-02-15 01:17:15 -07:00

17 lines
438 B
OCaml

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";
;;