[lua] fixed bug in template classes which cases template_default2 and template_specialization_defarg to fail.
Added several warning filters into the overload's test cases. Added runtime tests for several codes. You can now make check-lua-test-suite with no errors and only a few warnings. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10076 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
70759b3e16
commit
0c2bbb25a3
19 changed files with 368 additions and 15 deletions
55
Examples/test-suite/lua/overload_simple_runme.lua
Normal file
55
Examples/test-suite/lua/overload_simple_runme.lua
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
require("import") -- the import fn
|
||||
import("overload_simple") -- import code
|
||||
for k,v in pairs(overload_simple) do _G[k]=v end -- move to global
|
||||
|
||||
-- lua has only one numeric type, foo(int) and foo(double) are the same
|
||||
-- whichever one was wrapper first will be used
|
||||
|
||||
assert(foo(3)=="foo:int" or foo(3)=="foo:double") -- could be either
|
||||
assert(foo("hello")=="foo:char *")
|
||||
|
||||
f=Foo()
|
||||
b=Bar()
|
||||
|
||||
assert(foo(f)=="foo:Foo *")
|
||||
assert(foo(b)=="foo:Bar *")
|
||||
|
||||
v = malloc_void(32)
|
||||
|
||||
assert(foo(v) == "foo:void *")
|
||||
|
||||
s = Spam()
|
||||
|
||||
assert(s:foo(3) == "foo:int" or s:foo(3.0) == "foo:double") -- could be either
|
||||
assert(s:foo("hello") == "foo:char *")
|
||||
assert(s:foo(f) == "foo:Foo *")
|
||||
assert(s:foo(b) == "foo:Bar *")
|
||||
assert(s:foo(v) == "foo:void *")
|
||||
|
||||
assert(Spam_bar(3) == "bar:int" or Spam_bar(3.0) == "bar:double")
|
||||
assert(Spam_bar("hello") == "bar:char *")
|
||||
assert(Spam_bar(f) == "bar:Foo *")
|
||||
assert(Spam_bar(b) == "bar:Bar *")
|
||||
assert(Spam_bar(v) == "bar:void *")
|
||||
|
||||
-- Test constructors
|
||||
|
||||
s = Spam()
|
||||
assert(s.type == "none")
|
||||
|
||||
s = Spam(3)
|
||||
assert(s.type == "int" or s.type == "double")
|
||||
|
||||
s = Spam("hello")
|
||||
assert(s.type == "char *")
|
||||
|
||||
s = Spam(f)
|
||||
assert(s.type == "Foo *")
|
||||
|
||||
s = Spam(b)
|
||||
assert(s.type == "Bar *")
|
||||
|
||||
s = Spam(v)
|
||||
assert(s.type == "void *")
|
||||
|
||||
free_void(v)
|
||||
Loading…
Add table
Add a link
Reference in a new issue