diff options
Diffstat (limited to 'testes/errors.lua')
-rw-r--r-- | testes/errors.lua | 10 |
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 | ||
19 | local function doit (s) | 19 | local 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 |
24 | end | 24 | end |
@@ -312,8 +312,8 @@ end | |||
312 | 312 | ||
313 | local function lineerror (s, l) | 313 | local 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)) |
317 | end | 317 | end |
318 | 318 | ||
319 | lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2) | 319 | lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2) |
@@ -359,7 +359,7 @@ local p = [[ | |||
359 | g() | 359 | g() |
360 | ]] | 360 | ]] |
361 | X=3;lineerror((p), 3) | 361 | X=3;lineerror((p), 3) |
362 | X=0;lineerror((p), nil) | 362 | X=0;lineerror((p), false) |
363 | X=1;lineerror((p), 2) | 363 | X=1;lineerror((p), 2) |
364 | X=2;lineerror((p), 1) | 364 | X=2;lineerror((p), 1) |
365 | 365 | ||
@@ -510,7 +510,7 @@ checksyntax("a\1a = 1", "", "<\\1>", 1) | |||
510 | checksyntax("\255a = 1", "", "<\\255>", 1) | 510 | checksyntax("\255a = 1", "", "<\\255>", 1) |
511 | 511 | ||
512 | doit('I = load("a=9+"); a=3') | 512 | doit('I = load("a=9+"); a=3') |
513 | assert(a==3 and I == nil) | 513 | assert(a==3 and not I) |
514 | print('+') | 514 | print('+') |
515 | 515 | ||
516 | lim = 1000 | 516 | lim = 1000 |