fixed test case: dynamic_casts, exception_partial_info, li_std_string, size_t

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9636 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Gossage 2007-01-12 09:49:29 +00:00
commit e545d7b957
6 changed files with 77 additions and 10 deletions

View file

@ -12,19 +12,34 @@ function try1()
a:foo()
end
ok,ex=pcall(try1)
assert(ok==false and swig_type(ex)==swig_type(eo.E1()))
function try2()
a:bar()
end
ok,ex=pcall(try2)
assert(ok==false and swig_type(ex)==swig_type(eo.E2()))
function try3()
a:foobar()
end
-- the following code used to work
-- but now no longer works, as the lua bindings don't throw objects any more
-- all objects are converted to string & thrown
-- it could be made to work, if E1 & E2 were thrown by value (see lua.swg)
--[[
ok,ex=pcall(try1)
print(ok,ex)
assert(ok==false and swig_type(ex)==swig_type(eo.E1()))
ok,ex=pcall(try2)
assert(ok==false and swig_type(ex)==swig_type(eo.E2()))
]]
-- this new code does work, but has to look at the string
ok,ex=pcall(try1)
assert(ok==false and ex=="object exception:E1")
ok,ex=pcall(try2)
assert(ok==false and ex=="object exception:E2")
-- the SWIG_exception is just an error string
ok,ex=pcall(try3)
assert(ok==false and type(ex)=="string")
-- the SWIG_exception is just an error string