|
@@ -610,18 +610,20 @@ else
|
|
-- (bug in 5.2/5.3)
|
|
-- (bug in 5.2/5.3)
|
|
c = coroutine.create(function (a, ...)
|
|
c = coroutine.create(function (a, ...)
|
|
T.sethook("yield 0", "l") -- will yield on next two lines
|
|
T.sethook("yield 0", "l") -- will yield on next two lines
|
|
- assert(a == 10)
|
|
|
|
|
|
+ local b = a
|
|
return ...
|
|
return ...
|
|
end)
|
|
end)
|
|
|
|
|
|
assert(coroutine.resume(c, 1, 2, 3)) -- start coroutine
|
|
assert(coroutine.resume(c, 1, 2, 3)) -- start coroutine
|
|
local n,v = debug.getlocal(c, 0, 1) -- check its local
|
|
local n,v = debug.getlocal(c, 0, 1) -- check its local
|
|
- assert(n == "a" and v == 1)
|
|
|
|
|
|
+ assert(n == "a" and v == 1 and debug.getlocal(c, 0, 2) ~= "b")
|
|
assert(debug.setlocal(c, 0, 1, 10)) -- test 'setlocal'
|
|
assert(debug.setlocal(c, 0, 1, 10)) -- test 'setlocal'
|
|
local t = debug.getinfo(c, 0) -- test 'getinfo'
|
|
local t = debug.getinfo(c, 0) -- test 'getinfo'
|
|
- assert(t.currentline == t.linedefined + 1)
|
|
|
|
|
|
+ assert(t.currentline == t.linedefined + 2)
|
|
assert(not debug.getinfo(c, 1)) -- no other level
|
|
assert(not debug.getinfo(c, 1)) -- no other level
|
|
assert(coroutine.resume(c)) -- run next line
|
|
assert(coroutine.resume(c)) -- run next line
|
|
|
|
+ local n,v = debug.getlocal(c, 0, 2) -- check next local
|
|
|
|
+ assert(n == "b" and v == 10)
|
|
v = {coroutine.resume(c)} -- finish coroutine
|
|
v = {coroutine.resume(c)} -- finish coroutine
|
|
assert(v[1] == true and v[2] == 2 and v[3] == 3 and v[4] == undef)
|
|
assert(v[1] == true and v[2] == 2 and v[3] == 3 and v[4] == undef)
|
|
assert(not coroutine.resume(c))
|
|
assert(not coroutine.resume(c))
|