aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
Diffstat (limited to 'testes')
-rw-r--r--testes/coroutine.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 680fc605..17f6ceba 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -505,6 +505,25 @@ assert(not pcall(a, a))
505a = nil 505a = nil
506 506
507 507
508do
509 -- bug in 5.4: thread can use message handler higher in the stack
510 -- than the variable being closed
511 local c = coroutine.create(function()
512 local clo <close> = setmetatable({}, {__close=function()
513 local x = 134 -- will overwrite message handler
514 error(x)
515 end})
516 -- yields coroutine but leaves a new message handler for it,
517 -- that would be used when closing the coroutine (except that it
518 -- will be overwritten)
519 xpcall(coroutine.yield, function() return "XXX" end)
520 end)
521
522 assert(coroutine.resume(c)) -- start coroutine
523 local st, msg = coroutine.close(c)
524 assert(not st and msg == 134)
525end
526
508-- access to locals of erroneous coroutines 527-- access to locals of erroneous coroutines
509local x = coroutine.create (function () 528local x = coroutine.create (function ()
510 local a = 10 529 local a = 10