issue #198 add test

pull/200/head
Dibyendu Majumdar 4 years ago
parent 8cec4cc827
commit a54f156304

@ -0,0 +1,29 @@
g = compiler.load([[
local a: integer = 1
function f()
return function()
return function()
a = a + 1
return a
end
end, a
end
]]
)
assert(g and type(g) == 'function')
g()
assert(f and type(f) == 'function')
h, b = f()
assert(h and type(h) == 'function')
assert(b == 1)
k = h()
assert(k and type(k) == 'function')
b = k()
assert(b == 2)
b = k()
assert(b == 3)
l = h()
assert(l and type(l) == 'function')
b = l()
assert(b == 4)
assert('integer' == math.type(b))
Loading…
Cancel
Save