Modify octave exception checking test to take account of older (3.0) versions prefixing with 'error: ', but not in newer (3.2) versions

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12484 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-02-19 17:11:05 +00:00
commit 4447395ad3

View file

@ -2,8 +2,8 @@ exception_order
function check_lasterror(expected)
if (!strcmp(lasterror.message, expected))
# Take account of older versions adding a newline at the end
if (!strcmp(regexprep(lasterror.message, '(.*)\n$', '$1'), expected))
# Take account of older versions prefixing with "error: " and adding a newline at the end
if (!strcmp(regexprep(lasterror.message, 'error: (.*)\n$', '$1'), expected))
error(["Bad exception order. Expected: \"", expected, "\" Got: \"", lasterror.message, "\""])
endif
endif
@ -14,29 +14,29 @@ a = A();
try
a.foo()
catch
check_lasterror("error: C++ side threw an exception of type E1")
check_lasterror("C++ side threw an exception of type E1")
end_try_catch
try
a.bar()
catch
check_lasterror("error: C++ side threw an exception of type E2")
check_lasterror("C++ side threw an exception of type E2")
end_try_catch
try
a.foobar()
catch
check_lasterror("error: postcatch unknown (SWIG_RuntimeError)")
check_lasterror("postcatch unknown (SWIG_RuntimeError)")
end_try_catch
try
a.barfoo(1)
catch
check_lasterror("error: C++ side threw an exception of type E1")
check_lasterror("C++ side threw an exception of type E1")
end_try_catch
try
a.barfoo(2)
catch
check_lasterror("error: C++ side threw an exception of type E2 *")
check_lasterror("C++ side threw an exception of type E2 *")
end_try_catch