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/code.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'testes/code.lua') diff --git a/testes/code.lua b/testes/code.lua index 543743fc..bd4b10d0 100644 --- a/testes/code.lua +++ b/testes/code.lua @@ -86,7 +86,7 @@ checkKlist(foo, {1, 1.0, 2, 2.0, 0, 0.0}) -- testing opcodes -- check that 'f' opcodes match '...' -function check (f, ...) +local function check (f, ...) local arg = {...} local c = T.listcode(f) for i=1, #arg do @@ -99,7 +99,7 @@ end -- check that 'f' opcodes match '...' and that 'f(p) == r'. -function checkR (f, p, r, ...) +local function checkR (f, p, r, ...) local r1 = f(p) assert(r == r1 and math.type(r) == math.type(r1)) check(f, ...) @@ -107,7 +107,7 @@ end -- check that 'a' and 'b' has the same opcodes -function checkequal (a, b) +local function checkequal (a, b) a = T.listcode(a) b = T.listcode(b) assert(#a == #b) -- cgit v1.2.3-55-g6feb