Changes in the warning system

- The warning functions get an extra parameter that tells whether
message is to be continued (instead of using end-of-lines as a signal).

- The user data for the warning function is a regular value, instead
of a writable slot inside the Lua state.
This commit is contained in:
Roberto Ierusalimschy
2019-03-14 15:30:54 -03:00
parent 9eca305e75
commit b56d4e570a
12 changed files with 79 additions and 98 deletions

View File

@@ -6,7 +6,7 @@
local version = "Lua 5.4"
if _VERSION ~= version then
warn(string.format(
"This test suite is for %s, not for %s\nExiting tests\n", version, _VERSION))
"This test suite is for %s, not for %s\nExiting tests", version, _VERSION))
return
end
@@ -190,16 +190,16 @@ assert(dofile('verybig.lua', true) == 10); collectgarbage()
dofile('files.lua')
if #msgs > 0 then
warn("#tests not performed:\n ")
warn("#tests not performed:", true)
for i=1,#msgs do
warn(msgs[i]); warn("\n ")
warn("\n ", true); warn(msgs[i], true)
end
warn("\n")
end
print("(there should be two warnings now)")
warn("#This is "); warn("an expected"); warn(" warning\n")
warn("#This is"); warn(" another one\n")
warn("#This is ", true); warn("an expected", true); warn(" warning")
warn("#This is", true); warn(" another one")
-- no test module should define 'debug'
assert(debug == nil)