aboutsummaryrefslogtreecommitdiff
path: root/testes
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
parent4a3fd8488d617aa633f6b8be85e662653b100a59 (diff)
downloadlua-514d94274853e6f0dfd6bb2ffa2e1fc64db926dd.tar.gz
lua-514d94274853e6f0dfd6bb2ffa2e1fc64db926dd.tar.bz2
lua-514d94274853e6f0dfd6bb2ffa2e1fc64db926dd.zip
'coroutine.kill' renamed 'coroutine.close'
Diffstat (limited to 'testes')
-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)
123x, a = nil 123x, a = nil
124 124
125 125
126-- coroutine kill 126-- coroutine closing
127do 127do
128 -- ok to kill a dead coroutine 128 -- ok to close a dead coroutine
129 local co = coroutine.create(print) 129 local co = coroutine.create(print)
130 assert(coroutine.resume(co, "testing 'coroutine.kill'")) 130 assert(coroutine.resume(co, "testing 'coroutine.close'"))
131 assert(coroutine.status(co) == "dead") 131 assert(coroutine.status(co) == "dead")
132 assert(coroutine.kill(co)) 132 assert(coroutine.close(co))
133 133
134 -- cannot kill the running coroutine 134 -- cannot close the running coroutine
135 local st, msg = pcall(coroutine.kill, coroutine.running()) 135 local st, msg = pcall(coroutine.close, coroutine.running())
136 assert(not st and string.find(msg, "running")) 136 assert(not st and string.find(msg, "running"))
137 137
138 local main = coroutine.running() 138 local main = coroutine.running()
139 139
140 -- cannot kill a "normal" coroutine 140 -- cannot close a "normal" coroutine
141 ;(coroutine.wrap(function () 141 ;(coroutine.wrap(function ()
142 local st, msg = pcall(coroutine.kill, main) 142 local st, msg = pcall(coroutine.close, main)
143 assert(not st and string.find(msg, "normal")) 143 assert(not st and string.find(msg, "normal"))
144 end))() 144 end))()
145 145
@@ -159,10 +159,10 @@ do
159 end) 159 end)
160 coroutine.resume(co) 160 coroutine.resume(co)
161 assert(X) 161 assert(X)
162 assert(coroutine.kill(co)) 162 assert(coroutine.close(co))
163 assert(not X and coroutine.status(co) == "dead") 163 assert(not X and coroutine.status(co) == "dead")
164 164
165 -- error killing a coroutine 165 -- error closing a coroutine
166 co = coroutine.create(function() 166 co = coroutine.create(function()
167 local <toclose> x = func2close(function (self, err) 167 local <toclose> x = func2close(function (self, err)
168 assert(err == nil); error(111) 168 assert(err == nil); error(111)
@@ -170,7 +170,7 @@ do
170 coroutine.yield() 170 coroutine.yield()
171 end) 171 end)
172 coroutine.resume(co) 172 coroutine.resume(co)
173 local st, msg = coroutine.kill(co) 173 local st, msg = coroutine.close(co)
174 assert(not st and coroutine.status(co) == "dead" and msg == 111) 174 assert(not st and coroutine.status(co) == "dead" and msg == 111)
175 175
176end 176end