From 314745ed8438d1276c6c928d5f9d4be018dfadb6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 28 Dec 2022 18:34:11 -0300 Subject: 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. --- testes/files.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'testes/files.lua') diff --git a/testes/files.lua b/testes/files.lua index 78f962e5..be00bf3f 100644 --- a/testes/files.lua +++ b/testes/files.lua @@ -507,15 +507,17 @@ load((io.lines(file, 1)))() assert(_G.X == 4) load((io.lines(file, 3)))() assert(_G.X == 8) +_G.X = nil print('+') local x1 = "string\n\n\\com \"\"''coisas [[estranhas]] ]]'" io.output(file) -assert(io.write(string.format("x2 = %q\n-- comment without ending EOS", x1))) +assert(io.write(string.format("X2 = %q\n-- comment without ending EOS", x1))) io.close() assert(loadfile(file))() -assert(x1 == x2) +assert(x1 == _G.X2) +_G.X2 = nil print('+') assert(os.remove(file)) assert(not os.remove(file)) -- cgit v1.2.3-55-g6feb