aboutsummaryrefslogtreecommitdiff
path: root/testes/api.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/api.lua')
-rw-r--r--testes/api.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/testes/api.lua b/testes/api.lua
index 893a36cb..9904dadf 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -396,6 +396,23 @@ do
396 assert(string.find(msg, "stack overflow")) 396 assert(string.find(msg, "stack overflow"))
397 end 397 end
398 398
399 -- exit in panic still close to-be-closed variables
400 assert(T.checkpanic([[
401 pushstring "return {__close = function () Y = 'ho'; end}"
402 newtable
403 loadstring -2
404 call 0 1
405 setmetatable -2
406 toclose -1
407 pushstring "hi"
408 error
409 ]],
410 [[
411 getglobal Y
412 concat 2 # concat original error with global Y
413 ]]) == "hiho")
414
415
399end 416end
400 417
401-- testing deep C stack 418-- testing deep C stack
@@ -1115,7 +1132,7 @@ end)
1115testamem("to-be-closed variables", function() 1132testamem("to-be-closed variables", function()
1116 local flag 1133 local flag
1117 do 1134 do
1118 local *toclose x = function () flag = true end 1135 local *toclose x = setmetatable({}, {__close = function () flag = true end})
1119 flag = false 1136 flag = false
1120 local x = {} 1137 local x = {}
1121 end 1138 end