aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
Diffstat (limited to 'testes')
-rw-r--r--testes/main.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/testes/main.lua b/testes/main.lua
index 52c77954..9def6386 100644
--- a/testes/main.lua
+++ b/testes/main.lua
@@ -261,6 +261,34 @@ u2 = setmetatable({}, {__gc = function () error("ZYX") end})
261RUN('lua -W %s 2> %s', prog, out) 261RUN('lua -W %s 2> %s', prog, out)
262checkprogout("ZYX)\nXYZ)\n") 262checkprogout("ZYX)\nXYZ)\n")
263 263
264-- bug since 5.2: finalizer called when closing a state could
265-- subvert finalization order
266prepfile[[
267-- should be called last
268print("creating 1")
269setmetatable({}, {__gc = function () print(1) end})
270
271print("creating 2")
272setmetatable({}, {__gc = function ()
273 print("2")
274 print("creating 3")
275 -- this finalizer should not be called, as object will be
276 -- created after 'lua_close' has been called
277 setmetatable({}, {__gc = function () print(3) end})
278 print(collectgarbage()) -- cannot call collector here
279 os.exit(0, true)
280end})
281]]
282RUN('lua -W %s > %s', prog, out)
283checkout[[
284creating 1
285creating 2
2862
287creating 3
288nil
2891
290]]
291
264 292
265-- test many arguments 293-- test many arguments
266prepfile[[print(({...})[30])]] 294prepfile[[print(({...})[30])]]