First banch of tests
This commit is contained in:
parent
efe1d8aea7
commit
dfc02f306d
14 changed files with 385 additions and 0 deletions
27
Examples/test-suite/lua/friends_runme.lua
Normal file
27
Examples/test-suite/lua/friends_runme.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
require("import") -- the import fn
|
||||
import("friends") -- import lib into global
|
||||
f=friends --alias
|
||||
|
||||
-- catching undefined 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})
|
||||
|
||||
f.globalscope()
|
||||
|
||||
b1 = f.B(5)
|
||||
a1 = f.A(10)
|
||||
|
||||
assert(f.get_val1(a1) == 10)
|
||||
assert(f.get_val1(a1, 2) == 12)
|
||||
assert(f.get_val2(a1) == 20)
|
||||
assert(f.get_val3(a1) == 30)
|
||||
|
||||
assert(f.get_val1(100, 1, 2) == 100)
|
||||
|
||||
assert( f.mix(a1,b1) == 15);
|
||||
|
||||
d1 = f.D_i(7)
|
||||
assert(f.get_val1(d1) == 7)
|
||||
f.set(d1,9)
|
||||
assert(f.get_val1(d1) == 9)
|
||||
Loading…
Add table
Add a link
Reference in a new issue