Improvement in warn-mode '@store' (for testing)

When using warn-mode '@store', from the test library, the tests ensure
not only that the expected warnings were issued, but also that there was
no extra warnings.
This commit is contained in:
Roberto Ierusalimschy
2019-08-18 17:29:46 -03:00
parent 45948e7e55
commit 9405472565
5 changed files with 55 additions and 31 deletions

View File

@@ -177,10 +177,15 @@ do
end)
coroutine.resume(co)
assert(x == 0)
_WARN = nil; warn("@off"); warn("@store")
-- with test library, use 'store' mode to check warnings
warn(not T and "@off" or "@store")
local st, msg = coroutine.close(co)
warn("@on"); warn("@normal")
assert(_WARN == nil or string.find(_WARN, "200"))
if not T then
warn("@on")
else -- test library
assert(string.find(_WARN, "200")); _WARN = nil
warn("@normal")
end
assert(st == false and coroutine.status(co) == "dead" and msg == 111)
assert(x == 200)