aboutsummaryrefslogtreecommitdiff
path: root/testes/locals.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/locals.lua')
-rw-r--r--testes/locals.lua23
1 files changed, 15 insertions, 8 deletions
diff --git a/testes/locals.lua b/testes/locals.lua
index df44b86f..e2f6f35c 100644
--- a/testes/locals.lua
+++ b/testes/locals.lua
@@ -362,7 +362,7 @@ end
362 362
363local function checkwarn (msg) 363local function checkwarn (msg)
364 if T then 364 if T then
365 assert(string.find(_WARN, msg)) 365 assert(_WARN and string.find(_WARN, msg))
366 _WARN = false -- reset variable to check next warning 366 _WARN = false -- reset variable to check next warning
367 end 367 end
368end 368end
@@ -670,10 +670,13 @@ do
670 -- error in a wrapped coroutine raising errors when closing a variable 670 -- error in a wrapped coroutine raising errors when closing a variable
671 local x = 0 671 local x = 0
672 local co = coroutine.wrap(function () 672 local co = coroutine.wrap(function ()
673 local xx <close> = func2close(function () x = x + 1; error("@YYY") end) 673 local xx <close> = func2close(function ()
674 x = x + 1;
675 checkwarn("@XXX"); error("@YYY")
676 end)
674 local xv <close> = func2close(function () x = x + 1; error("@XXX") end) 677 local xv <close> = func2close(function () x = x + 1; error("@XXX") end)
675 coroutine.yield(100) 678 coroutine.yield(100)
676 error(200) 679 error(200)
677 end) 680 end)
678 assert(co() == 100); assert(x == 0) 681 assert(co() == 100); assert(x == 0)
679 local st, msg = pcall(co); assert(x == 2) 682 local st, msg = pcall(co); assert(x == 2)
@@ -683,10 +686,14 @@ do
683 local x = 0 686 local x = 0
684 local y = 0 687 local y = 0
685 co = coroutine.wrap(function () 688 co = coroutine.wrap(function ()
686 local xx <close> = func2close(function () y = y + 1; error("YYY") end) 689 local xx <close> = func2close(function ()
687 local xv <close> = func2close(function () x = x + 1; error("XXX") end) 690 y = y + 1; checkwarn("XXX"); error("YYY")
688 coroutine.yield(100) 691 end)
689 return 200 692 local xv <close> = func2close(function ()
693 x = x + 1; error("XXX")
694 end)
695 coroutine.yield(100)
696 return 200
690 end) 697 end)
691 assert(co() == 100); assert(x == 0) 698 assert(co() == 100); assert(x == 0)
692 local st, msg = pcall(co) 699 local st, msg = pcall(co)