aboutsummaryrefslogtreecommitdiff
path: root/testes/coroutine.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testes/coroutine.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 198a5870..f2c0da8b 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -163,15 +163,23 @@ do
163 assert(not X and coroutine.status(co) == "dead") 163 assert(not X and coroutine.status(co) == "dead")
164 164
165 -- error closing a coroutine 165 -- error closing a coroutine
166 local x = 0
166 co = coroutine.create(function() 167 co = coroutine.create(function()
168 local <toclose> y = func2close(function (self,err)
169 if (err ~= 111) then os.exit(false) end -- should not happen
170 x = 200
171 error(200)
172 end)
167 local <toclose> x = func2close(function (self, err) 173 local <toclose> x = func2close(function (self, err)
168 assert(err == nil); error(111) 174 assert(err == nil); error(111)
169 end) 175 end)
170 coroutine.yield() 176 coroutine.yield()
171 end) 177 end)
172 coroutine.resume(co) 178 coroutine.resume(co)
179 assert(x == 0)
173 local st, msg = coroutine.close(co) 180 local st, msg = coroutine.close(co)
174 assert(not st and coroutine.status(co) == "dead" and msg == 111) 181 assert(st == false and coroutine.status(co) == "dead" and msg == 111)
182 assert(x == 200)
175 183
176end 184end
177 185