Tests for enum/consts old-style bindings and for static const char; bindings
This commit is contained in:
parent
89bc5576c9
commit
b901979d1c
3 changed files with 28 additions and 0 deletions
|
|
@ -59,6 +59,9 @@ cb.Bar_global_fval=cb.Foo(-34)
|
|||
assert(cb.Bar_global_fval.num==-34)
|
||||
assert(cb.Bar.global_fval.num==-34)
|
||||
|
||||
assert(cb.Bar.global_cint == -4)
|
||||
assert(cb.Bar_global_cint == -4)
|
||||
|
||||
-- Now test member function pointers
|
||||
func1_ptr=cb.get_func1_ptr()
|
||||
func2_ptr=cb.get_func2_ptr()
|
||||
|
|
|
|||
21
Examples/test-suite/lua/cpp_enum_runme.lua
Normal file
21
Examples/test-suite/lua/cpp_enum_runme.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
require("import") -- the import fn
|
||||
import("cpp_enum") -- import code
|
||||
ce=cpp_enum -- renaming import
|
||||
|
||||
-- catch "undefined" global variables
|
||||
local env = _ENV -- Lua 5.2
|
||||
if not env then env = getfenv () end -- Lua 5.1
|
||||
setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i.."'",2) end})
|
||||
|
||||
assert(ce.ENUM_ONE ~= nil)
|
||||
assert(ce.ENUM_TWO ~= nil)
|
||||
|
||||
-- Enums inside classes
|
||||
assert(ce.Foo.Hi == 0)
|
||||
assert(ce.Foo.Hello == 1);
|
||||
-- old-style bindings
|
||||
assert(ce.Foo_Hi == 0)
|
||||
assert(ce.Foo_Hello == 1);
|
||||
|
||||
assert(ce.Hi == 0)
|
||||
assert(ce.Hello == 1)
|
||||
|
|
@ -10,8 +10,12 @@ setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i
|
|||
assert(scm.X.PN == 0)
|
||||
assert(scm.X.CN == 1)
|
||||
assert(scm.X.EN == 2)
|
||||
assert(scm.X.CHARTEST == "A")
|
||||
|
||||
-- Old-style bindings
|
||||
assert(scm.X_PN == 0)
|
||||
assert(scm.X_CN == 1)
|
||||
assert(scm.X_EN == 2)
|
||||
assert(scm.X_CHARTEST == "A")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue