More tests
This commit is contained in:
parent
b9ba05be81
commit
89bc5576c9
12 changed files with 206 additions and 0 deletions
22
Examples/test-suite/lua/nested_workaround_runme.lua
Normal file
22
Examples/test-suite/lua/nested_workaround_runme.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
require("import") -- the import fn
|
||||
import("nested_workaround") -- import lib
|
||||
nw=nested_workaround
|
||||
|
||||
-- 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})
|
||||
|
||||
i1 = nw.Inner(5)
|
||||
assert(i1:getValue() == 5)
|
||||
i1:setValue(7)
|
||||
assert(i1:getValue() == 7)
|
||||
|
||||
o1 = nw.Outer()
|
||||
i2 = o1:createInner(9)
|
||||
assert(i2:getValue() == 9)
|
||||
i2:setValue(11)
|
||||
assert(o1:getInnerValue(i2) == 11)
|
||||
|
||||
i3 = o1:doubleInnerValue(i2)
|
||||
assert(i3:getValue() == 22)
|
||||
Loading…
Add table
Add a link
Reference in a new issue