swig/Examples/test-suite/scilab/throw_exception_runme.sci
luz.paz 60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00

23 lines
694 B
Scilab

exec("swigtest.start", -1);
function checkException(cmd, expected_error_msg)
ierr = execstr(cmd, 'errcatch');
checkequal(ierr, 20000, cmd + ': ierr');
checkequal(lasterror(), 'SWIG/Scilab: ' + expected_error_msg, cmd + ': msg');
endfunction
foo = new_Foo();
checkException('Foo_test_int(foo)', 'Exception (int) occurred: 37');
checkException('Foo_test_msg(foo)', 'Exception (char const *) occurred: Dead');
checkException('Foo_test_multi(foo, 1)', 'Exception (int) occurred: 37');
checkException('Foo_test_multi(foo, 2)', 'Exception (char const *) occurred: Dead');
checkException('Foo_test_cls(foo)', 'Exception (CError) occurred.');
delete_Foo(foo);
exec("swigtest.quit", -1);