summaryrefslogtreecommitdiff
path: root/testes/coroutine.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-06-03 13:11:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-06-03 13:11:20 -0300
commit514d94274853e6f0dfd6bb2ffa2e1fc64db926dd (patch)
treee024ebca966e8a84a7997c3908b74bb941dcbd50 /testes/coroutine.lua
parent4a3fd8488d617aa633f6b8be85e662653b100a59 (diff)
downloadlua-github-514d94274853e6f0dfd6bb2ffa2e1fc64db926dd.tar.gz
'coroutine.kill' renamed 'coroutine.close'
Diffstat (limited to 'testes/coroutine.lua')
-rw-r--r--testes/coroutine.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index db6d074e..198a5870 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -123,23 +123,23 @@ assert(#a == 22 and a[#a] == 79)
x, a = nil
--- coroutine kill
+-- coroutine closing
do
- -- ok to kill a dead coroutine
+ -- ok to close a dead coroutine
local co = coroutine.create(print)
- assert(coroutine.resume(co, "testing 'coroutine.kill'"))
+ assert(coroutine.resume(co, "testing 'coroutine.close'"))
assert(coroutine.status(co) == "dead")
- assert(coroutine.kill(co))
+ assert(coroutine.close(co))
- -- cannot kill the running coroutine
- local st, msg = pcall(coroutine.kill, coroutine.running())
+ -- cannot close the running coroutine
+ local st, msg = pcall(coroutine.close, coroutine.running())
assert(not st and string.find(msg, "running"))
local main = coroutine.running()
- -- cannot kill a "normal" coroutine
+ -- cannot close a "normal" coroutine
;(coroutine.wrap(function ()
- local st, msg = pcall(coroutine.kill, main)
+ local st, msg = pcall(coroutine.close, main)
assert(not st and string.find(msg, "normal"))
end))()
@@ -159,10 +159,10 @@ do
end)
coroutine.resume(co)
assert(X)
- assert(coroutine.kill(co))
+ assert(coroutine.close(co))
assert(not X and coroutine.status(co) == "dead")
- -- error killing a coroutine
+ -- error closing a coroutine
co = coroutine.create(function()
local <toclose> x = func2close(function (self, err)
assert(err == nil); error(111)
@@ -170,7 +170,7 @@ do
coroutine.yield()
end)
coroutine.resume(co)
- local st, msg = coroutine.kill(co)
+ local st, msg = coroutine.close(co)
assert(not st and coroutine.status(co) == "dead" and msg == 111)
end