diff options
Diffstat (limited to 'testes/main.lua')
-rw-r--r-- | testes/main.lua | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/testes/main.lua b/testes/main.lua index c7bde0d9..b9dcab1c 100644 --- a/testes/main.lua +++ b/testes/main.lua | |||
@@ -254,15 +254,15 @@ NoRun("error object is a table value", [[lua %s]], prog) | |||
254 | 254 | ||
255 | 255 | ||
256 | -- chunk broken in many lines | 256 | -- chunk broken in many lines |
257 | s = [=[ -- | 257 | s = [=[ -- |
258 | function f ( x ) | 258 | function f ( x ) |
259 | local a = [[ | 259 | local a = [[ |
260 | xuxu | 260 | xuxu |
261 | ]] | 261 | ]] |
262 | local b = "\ | 262 | local b = "\ |
263 | xuxu\n" | 263 | xuxu\n" |
264 | if x == 11 then return 1 + 12 , 2 + 20 end --[[ test multiple returns ]] | 264 | if x == 11 then return 1 + 12 , 2 + 20 end --[[ test multiple returns ]] |
265 | return x + 1 | 265 | return x + 1 |
266 | --\\ | 266 | --\\ |
267 | end | 267 | end |
268 | return( f( 100 ) ) | 268 | return( f( 100 ) ) |
@@ -272,10 +272,10 @@ s = string.gsub(s, ' ', '\n\n') -- change all spaces for newlines | |||
272 | prepfile(s) | 272 | prepfile(s) |
273 | RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) | 273 | RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) |
274 | checkprogout("101\n13\t22\n\n") | 274 | checkprogout("101\n13\t22\n\n") |
275 | 275 | ||
276 | prepfile[[#comment in 1st line without \n at the end]] | 276 | prepfile[[#comment in 1st line without \n at the end]] |
277 | RUN('lua %s', prog) | 277 | RUN('lua %s', prog) |
278 | 278 | ||
279 | prepfile[[#test line number when file starts with comment line | 279 | prepfile[[#test line number when file starts with comment line |
280 | debug = require"debug" | 280 | debug = require"debug" |
281 | print(debug.getinfo(1).currentline) | 281 | print(debug.getinfo(1).currentline) |
@@ -306,6 +306,20 @@ NoRun("", "lua %s", prog) -- no message | |||
306 | prepfile("os.exit(false, true)") | 306 | prepfile("os.exit(false, true)") |
307 | NoRun("", "lua %s", prog) -- no message | 307 | NoRun("", "lua %s", prog) -- no message |
308 | 308 | ||
309 | |||
310 | -- to-be-closed variables in main chunk | ||
311 | prepfile[[ | ||
312 | local *toclose x = function (err) | ||
313 | assert(err == 120) | ||
314 | print("Ok") | ||
315 | end | ||
316 | local *toclose e1 = function () error(120) end | ||
317 | os.exit(true, true) | ||
318 | ]] | ||
319 | RUN('lua %s > %s', prog, out) | ||
320 | checkprogout("Ok") | ||
321 | |||
322 | |||
309 | -- remove temporary files | 323 | -- remove temporary files |
310 | assert(os.remove(prog)) | 324 | assert(os.remove(prog)) |
311 | assert(os.remove(otherprog)) | 325 | assert(os.remove(otherprog)) |