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 e566c86e..03e04451 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -493,6 +493,25 @@ assert(not pcall(a, a))
493a = nil 493a = nil
494 494
495 495
496do
497 -- bug in 5.4: thread can use message handler higher in the stack
498 -- than the variable being closed
499 local c = coroutine.create(function()
500 local clo <close> = setmetatable({}, {__close=function()
501 local x = 134 -- will overwrite message handler
502 error(x)
503 end})
504 -- yields coroutine but leaves a new message handler for it,
505 -- that would be used when closing the coroutine (except that it
506 -- will be overwritten)
507 xpcall(coroutine.yield, function() return "XXX" end)
508 end)
509
510 assert(coroutine.resume(c)) -- start coroutine
511 local st, msg = coroutine.close(c)
512 assert(not st and msg == 134)
513end
514
496-- access to locals of erroneous coroutines 515-- access to locals of erroneous coroutines
497local x = coroutine.create (function () 516local x = coroutine.create (function ()
498 local a = 10 517 local a = 10