Skip to content

Commit

Permalink
issue #198 add test
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyendumajumdar committed Nov 7, 2020
1 parent 8cec4cc commit a54f156
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/comptests/20_upvals.lua
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit a54f156

Please sign in to comment.