aboutsummaryrefslogtreecommitdiff
path: root/testes/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/main.lua')
-rw-r--r--testes/main.lua24
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
257s = [=[ -- 257s = [=[ --
258function f ( x ) 258function f ( x )
259 local a = [[ 259 local a = [[
260xuxu 260xuxu
261]] 261]]
262 local b = "\ 262 local b = "\
263xuxu\n" 263xuxu\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 --\\
267end 267end
268return( f( 100 ) ) 268return( f( 100 ) )
@@ -272,10 +272,10 @@ s = string.gsub(s, ' ', '\n\n') -- change all spaces for newlines
272prepfile(s) 272prepfile(s)
273RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) 273RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)
274checkprogout("101\n13\t22\n\n") 274checkprogout("101\n13\t22\n\n")
275 275
276prepfile[[#comment in 1st line without \n at the end]] 276prepfile[[#comment in 1st line without \n at the end]]
277RUN('lua %s', prog) 277RUN('lua %s', prog)
278 278
279prepfile[[#test line number when file starts with comment line 279prepfile[[#test line number when file starts with comment line
280debug = require"debug" 280debug = require"debug"
281print(debug.getinfo(1).currentline) 281print(debug.getinfo(1).currentline)
@@ -306,6 +306,20 @@ NoRun("", "lua %s", prog) -- no message
306prepfile("os.exit(false, true)") 306prepfile("os.exit(false, true)")
307NoRun("", "lua %s", prog) -- no message 307NoRun("", "lua %s", prog) -- no message
308 308
309
310-- to-be-closed variables in main chunk
311prepfile[[
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]]
319RUN('lua %s > %s', prog, out)
320checkprogout("Ok")
321
322
309-- remove temporary files 323-- remove temporary files
310assert(os.remove(prog)) 324assert(os.remove(prog))
311assert(os.remove(otherprog)) 325assert(os.remove(otherprog))