aboutsummaryrefslogtreecommitdiff
path: root/testes/errors.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/errors.lua')
-rw-r--r--testes/errors.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/testes/errors.lua b/testes/errors.lua
index 6e7b8004..f9623b1d 100644
--- a/testes/errors.lua
+++ b/testes/errors.lua
@@ -18,7 +18,7 @@ end
18 18
19local function doit (s) 19local function doit (s)
20 local f, msg = load(s) 20 local f, msg = load(s)
21 if f == nil then return msg end 21 if not f then return msg end
22 local cond, msg = pcall(f) 22 local cond, msg = pcall(f)
23 return (not cond) and msg 23 return (not cond) and msg
24end 24end
@@ -312,8 +312,8 @@ end
312 312
313local function lineerror (s, l) 313local function lineerror (s, l)
314 local err,msg = pcall(load(s)) 314 local err,msg = pcall(load(s))
315 local line = string.match(msg, ":(%d+):") 315 local line = tonumber(string.match(msg, ":(%d+):"))
316 assert(tonumber(line) == l) 316 assert(line == l or (not line and not l))
317end 317end
318 318
319lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2) 319lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2)
@@ -359,7 +359,7 @@ local p = [[
359g() 359g()
360]] 360]]
361X=3;lineerror((p), 3) 361X=3;lineerror((p), 3)
362X=0;lineerror((p), nil) 362X=0;lineerror((p), false)
363X=1;lineerror((p), 2) 363X=1;lineerror((p), 2)
364X=2;lineerror((p), 1) 364X=2;lineerror((p), 1)
365 365
@@ -510,7 +510,7 @@ checksyntax("a\1a = 1", "", "<\\1>", 1)
510checksyntax("\255a = 1", "", "<\\255>", 1) 510checksyntax("\255a = 1", "", "<\\255>", 1)
511 511
512doit('I = load("a=9+"); a=3') 512doit('I = load("a=9+"); a=3')
513assert(a==3 and I == nil) 513assert(a==3 and not I)
514print('+') 514print('+')
515 515
516lim = 1000 516lim = 1000