diff options
Diffstat (limited to 'testes/errors.lua')
| -rw-r--r-- | testes/errors.lua | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/testes/errors.lua b/testes/errors.lua index 63a7b740..19a7b6fa 100644 --- a/testes/errors.lua +++ b/testes/errors.lua | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | -- $Id: errors.lua,v 1.97 2017/11/28 15:31:56 roberto Exp $ | 1 | -- $Id: errors.lua $ |
| 2 | -- See Copyright Notice in file all.lua | 2 | -- See Copyright Notice in file all.lua |
| 3 | 3 | ||
| 4 | print("testing errors") | 4 | print("testing errors") |
| @@ -299,7 +299,7 @@ end | |||
| 299 | local function lineerror (s, l) | 299 | local function lineerror (s, l) |
| 300 | local err,msg = pcall(load(s)) | 300 | local err,msg = pcall(load(s)) |
| 301 | local line = string.match(msg, ":(%d+):") | 301 | local line = string.match(msg, ":(%d+):") |
| 302 | assert((line and line+0) == l) | 302 | assert(tonumber(line) == l) |
| 303 | end | 303 | end |
| 304 | 304 | ||
| 305 | lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2) | 305 | lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2) |
| @@ -350,6 +350,23 @@ X=1;lineerror((p), 2) | |||
| 350 | X=2;lineerror((p), 1) | 350 | X=2;lineerror((p), 1) |
| 351 | 351 | ||
| 352 | 352 | ||
| 353 | lineerror([[ | ||
| 354 | local b = false | ||
| 355 | if not b then | ||
| 356 | error 'test' | ||
| 357 | end]], 3) | ||
| 358 | |||
| 359 | lineerror([[ | ||
| 360 | local b = false | ||
| 361 | if not b then | ||
| 362 | if not b then | ||
| 363 | if not b then | ||
| 364 | error 'test' | ||
| 365 | end | ||
| 366 | end | ||
| 367 | end]], 5) | ||
| 368 | |||
| 369 | |||
| 353 | if not _soft then | 370 | if not _soft then |
| 354 | -- several tests that exaust the Lua stack | 371 | -- several tests that exaust the Lua stack |
| 355 | collectgarbage() | 372 | collectgarbage() |
