Supressed errors in '__close' generate warnings

This commit is contained in:
Roberto Ierusalimschy
2019-08-16 09:51:54 -03:00
parent a1d8eb2743
commit ca13be9af7
10 changed files with 166 additions and 45 deletions

View File

@@ -168,7 +168,7 @@ do
local y <close> = func2close(function (self,err)
if (err ~= 111) then os.exit(false) end -- should not happen
x = 200
error(200)
error("200")
end)
local x <close> = func2close(function (self, err)
assert(err == nil); error(111)
@@ -177,7 +177,10 @@ do
end)
coroutine.resume(co)
assert(x == 0)
_WARN = nil; warn("@off"); warn("@store")
local st, msg = coroutine.close(co)
warn("@on"); warn("@normal")
assert(_WARN == nil or string.find(_WARN, "200"))
assert(st == false and coroutine.status(co) == "dead" and msg == 111)
assert(x == 200)