aboutsummaryrefslogtreecommitdiff
path: root/testes/all.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-12-28 15:42:34 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-12-28 15:42:34 -0200
commit437a5b07d415e1a74160ddfd804017171d6cc5cb (patch)
tree861f9a56ae175eaed91c163409c33ab85bee7ff9 /testes/all.lua
parentba7da13ec5938f978c37d63aa40a3e340b301f79 (diff)
downloadlua-437a5b07d415e1a74160ddfd804017171d6cc5cb.tar.gz
lua-437a5b07d415e1a74160ddfd804017171d6cc5cb.tar.bz2
lua-437a5b07d415e1a74160ddfd804017171d6cc5cb.zip
Added a warning system to Lua
The warning system is just a way for Lua to emit warnings, messages to the programmer that do not interfere with the running program.
Diffstat (limited to 'testes/all.lua')
-rw-r--r--testes/all.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/testes/all.lua b/testes/all.lua
index 84ba80a6..bde4195e 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 io.stderr:write("\nThis test suite is for ", version, ", not for ", _VERSION, 8 warn(string.format(
9 "\nExiting tests\n") 9 "This test suite is for %s, not for %s\nExiting tests\n", version, _VERSION))
10 return 10 return
11end 11end
12 12
@@ -190,11 +190,10 @@ assert(dofile('verybig.lua', true) == 10); collectgarbage()
190dofile('files.lua') 190dofile('files.lua')
191 191
192if #msgs > 0 then 192if #msgs > 0 then
193 print("\ntests not performed:") 193 warn("*tests not performed:\n ")
194 for i=1,#msgs do 194 for i=1,#msgs do
195 print(msgs[i]) 195 warn(msgs[i]); warn("\n ")
196 end 196 end
197 print()
198end 197end
199 198
200-- no test module should define 'debug' 199-- no test module should define 'debug'
@@ -220,6 +219,10 @@ local _G, showmem, print, format, clock, time, difftime, assert, open =
220local fname = T and "time-debug.txt" or "time.txt" 219local fname = T and "time-debug.txt" or "time.txt"
221local lasttime 220local lasttime
222 221
222
223warn("*This is "); warn("an expected"); warn(" warning\n")
224warn("*This is"); warn(" another one\n")
225
223if not usertests then 226if not usertests then
224 -- open file with time of last performed test 227 -- open file with time of last performed test
225 local f = io.open(fname) 228 local f = io.open(fname)