Avoid excessive name pollution in test files

Test files are more polite regarding the use of globals when locals
would do, and when globals are necessary deleting them after use.
This commit is contained in:
Roberto Ierusalimschy
2022-12-28 18:34:11 -03:00
parent 0825cf237d
commit 314745ed84
26 changed files with 333 additions and 259 deletions

View File

@@ -37,7 +37,7 @@ end
f = nil
local f
x = 1
local x = 1
a = nil
load('local a = {}')()
@@ -152,7 +152,7 @@ local dummy
local _ENV = (function (...) return ... end)(_G, dummy) -- {
do local _ENV = {assert=assert}; assert(true) end
mt = {_G = _G}
local mt = {_G = _G}
local foo,x
A = false -- "declare" A
do local _ENV = mt
@@ -174,6 +174,8 @@ do local _ENV = {assert=assert, A=10};
end
assert(x==20)
A = nil
do -- constants
local a<const>, b, c<const> = 10, 20, 30
@@ -711,7 +713,7 @@ if rawget(_G, "T") then
collectgarbage(); collectgarbage()
m = T.totalmem()
local m = T.totalmem()
collectgarbage("stop")
-- error in the first buffer allocation