Add test case for Lua __getitem + inheritance
This commit is contained in:
parent
4363160400
commit
be907f96e0
3 changed files with 32 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ top_builddir = @top_builddir@
|
||||||
|
|
||||||
CPP_TEST_CASES += \
|
CPP_TEST_CASES += \
|
||||||
lua_no_module_global \
|
lua_no_module_global \
|
||||||
|
lua_inherit_getitem \
|
||||||
|
|
||||||
|
|
||||||
C_TEST_CASES += \
|
C_TEST_CASES += \
|
||||||
|
|
|
||||||
12
Examples/test-suite/lua/lua_inherit_getitem_runme.lua
Normal file
12
Examples/test-suite/lua/lua_inherit_getitem_runme.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
require("import") -- the import fn
|
||||||
|
import("lua_inherit_getitem") -- import lib
|
||||||
|
|
||||||
|
local t = lua_inherit_getitem;
|
||||||
|
local base = t.CBase()
|
||||||
|
local derived = t.CDerived()
|
||||||
|
|
||||||
|
assert(base.Foo ~= nil)
|
||||||
|
assert(base:Foo() == "CBase::Foo")
|
||||||
|
assert(derived.Foo == base.Foo)
|
||||||
|
assert(derived:Foo() == "CBase::Foo")
|
||||||
|
|
||||||
19
Examples/test-suite/lua_inherit_getitem.i
Normal file
19
Examples/test-suite/lua_inherit_getitem.i
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
%module lua_inherit_getitem
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
class CBase {
|
||||||
|
public:
|
||||||
|
const char* Foo(void) {
|
||||||
|
return "CBase::Foo";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class CDerived : public CBase {
|
||||||
|
public:
|
||||||
|
void *__getitem(const char *name) const {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
%}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue