aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
Diffstat (limited to 'testes')
-rw-r--r--testes/all.lua5
-rw-r--r--testes/coroutine.lua1
-rw-r--r--testes/gc.lua2
-rw-r--r--testes/locals.lua1
-rw-r--r--testes/main.lua11
5 files changed, 13 insertions, 7 deletions
diff --git a/testes/all.lua b/testes/all.lua
index 42809b9a..db074dd8 100644
--- a/testes/all.lua
+++ b/testes/all.lua
@@ -5,8 +5,8 @@
5 5
6local version = "Lua 5.4" 6local version = "Lua 5.4"
7if _VERSION ~= version then 7if _VERSION ~= version then
8 warn("This test suite is for ", version, 8 io.stderr:write("This test suite is for ", version,
9 ", not for ", _VERSION, "\nExiting tests") 9 ", not for ", _VERSION, "\nExiting tests")
10 return 10 return
11end 11end
12 12
@@ -210,6 +210,7 @@ if #msgs > 0 then
210end 210end
211 211
212print("(there should be two warnings now)") 212print("(there should be two warnings now)")
213warn("@on")
213warn("#This is ", "an expected", " warning") 214warn("#This is ", "an expected", " warning")
214warn("@off") 215warn("@off")
215warn("******** THIS WARNING SHOULD NOT APPEAR **********") 216warn("******** THIS WARNING SHOULD NOT APPEAR **********")
diff --git a/testes/coroutine.lua b/testes/coroutine.lua
index 4fc23261..79bbf2ea 100644
--- a/testes/coroutine.lua
+++ b/testes/coroutine.lua
@@ -163,6 +163,7 @@ do
163 assert(not X and coroutine.status(co) == "dead") 163 assert(not X and coroutine.status(co) == "dead")
164 164
165 -- error closing a coroutine 165 -- error closing a coroutine
166 warn("@on")
166 local x = 0 167 local x = 0
167 co = coroutine.create(function() 168 co = coroutine.create(function()
168 local y <close> = func2close(function (self,err) 169 local y <close> = func2close(function (self,err)
diff --git a/testes/gc.lua b/testes/gc.lua
index 34854d6f..bb4e3493 100644
--- a/testes/gc.lua
+++ b/testes/gc.lua
@@ -369,7 +369,7 @@ if T then
369 s[n] = i 369 s[n] = i
370 end 370 end
371 371
372 warn("@store") 372 warn("@on"); warn("@store")
373 collectgarbage() 373 collectgarbage()
374 assert(string.find(_WARN, "error in __gc metamethod")) 374 assert(string.find(_WARN, "error in __gc metamethod"))
375 assert(string.match(_WARN, "@(.-)@") == "expected"); _WARN = nil 375 assert(string.match(_WARN, "@(.-)@") == "expected"); _WARN = nil
diff --git a/testes/locals.lua b/testes/locals.lua
index b4de523d..58ad18cc 100644
--- a/testes/locals.lua
+++ b/testes/locals.lua
@@ -313,6 +313,7 @@ local function checkwarn (msg)
313 end 313 end
314end 314end
315 315
316warn("@on")
316 317
317do print("testing errors in __close") 318do print("testing errors in __close")
318 319
diff --git a/testes/main.lua b/testes/main.lua
index 5d2652cb..de14a088 100644
--- a/testes/main.lua
+++ b/testes/main.lua
@@ -221,8 +221,11 @@ assert(string.find(getoutput(), "error calling 'print'"))
221RUN('echo "io.stderr:write(1000)\ncont" | lua -e "require\'debug\'.debug()" 2> %s', out) 221RUN('echo "io.stderr:write(1000)\ncont" | lua -e "require\'debug\'.debug()" 2> %s', out)
222checkout("lua_debug> 1000lua_debug> ") 222checkout("lua_debug> 1000lua_debug> ")
223 223
224-- test warnings 224
225RUN('echo "io.stderr:write(1); warn[[XXX]]" | lua -q 2> %s', out) 225print("testing warnings")
226
227-- no warnings by default
228RUN('echo "io.stderr:write(1); warn[[XXX]]" | lua 2> %s', out)
226checkout("1") 229checkout("1")
227 230
228prepfile[[ 231prepfile[[
@@ -236,7 +239,7 @@ warn("", "@on") -- again, no control, real warning
236warn("@on") -- keep it "started" 239warn("@on") -- keep it "started"
237warn("Z", "Z", "Z") -- common warning 240warn("Z", "Z", "Z") -- common warning
238]] 241]]
239RUN('lua %s 2> %s', prog, out) 242RUN('lua -W %s 2> %s', prog, out)
240checkout[[ 243checkout[[
241Lua warning: @offXXX@off 244Lua warning: @offXXX@off
242Lua warning: @on 245Lua warning: @on
@@ -250,7 +253,7 @@ warn("@allow")
250u1 = setmetatable({}, {__gc = function () error("XYZ") end}) 253u1 = setmetatable({}, {__gc = function () error("XYZ") end})
251u2 = setmetatable({}, {__gc = function () error("ZYX") end}) 254u2 = setmetatable({}, {__gc = function () error("ZYX") end})
252]] 255]]
253RUN('lua %s 2> %s', prog, out) 256RUN('lua -W %s 2> %s', prog, out)
254checkprogout("ZYX)\nXYZ)\n") 257checkprogout("ZYX)\nXYZ)\n")
255 258
256 259