summaryrefslogtreecommitdiff
path: root/Examples/test-suite/lua/dynamic_cast_runme.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/lua/dynamic_cast_runme.lua')
-rw-r--r--Examples/test-suite/lua/dynamic_cast_runme.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/Examples/test-suite/lua/dynamic_cast_runme.lua b/Examples/test-suite/lua/dynamic_cast_runme.lua
new file mode 100644
index 0000000..6e0a1d2
--- /dev/null
+++ b/Examples/test-suite/lua/dynamic_cast_runme.lua
@@ -0,0 +1,15 @@
+require("import") -- the import fn
+import("dynamic_cast") -- import code
+
+f = dynamic_cast.Foo()
+b = dynamic_cast.Bar()
+
+x = f:blah()
+y = b:blah()
+
+-- swig_type is a swiglua specific function which gets the swig_type_info's name
+assert(swig_type(f)==swig_type(x))
+assert(swig_type(b)==swig_type(y))
+
+-- the real test: is y a Foo* or a Bar*?
+assert(dynamic_cast.do_test(y)=="Bar::test")