diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-28 18:34:11 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-28 18:34:11 -0300 |
commit | 314745ed8438d1276c6c928d5f9d4be018dfadb6 (patch) | |
tree | 594b7e873f2c29113d95c75147ab10865cdd772c /testes/code.lua | |
parent | 0825cf237d9d3505155f8b40bcf83ea1b135e8da (diff) | |
download | lua-314745ed8438d1276c6c928d5f9d4be018dfadb6.tar.gz lua-314745ed8438d1276c6c928d5f9d4be018dfadb6.tar.bz2 lua-314745ed8438d1276c6c928d5f9d4be018dfadb6.zip |
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.
Diffstat (limited to 'testes/code.lua')
-rw-r--r-- | testes/code.lua | 6 |
1 files changed, 3 insertions, 3 deletions
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}) | |||
86 | -- testing opcodes | 86 | -- testing opcodes |
87 | 87 | ||
88 | -- check that 'f' opcodes match '...' | 88 | -- check that 'f' opcodes match '...' |
89 | function check (f, ...) | 89 | local function check (f, ...) |
90 | local arg = {...} | 90 | local arg = {...} |
91 | local c = T.listcode(f) | 91 | local c = T.listcode(f) |
92 | for i=1, #arg do | 92 | for i=1, #arg do |
@@ -99,7 +99,7 @@ end | |||
99 | 99 | ||
100 | 100 | ||
101 | -- check that 'f' opcodes match '...' and that 'f(p) == r'. | 101 | -- check that 'f' opcodes match '...' and that 'f(p) == r'. |
102 | function checkR (f, p, r, ...) | 102 | local function checkR (f, p, r, ...) |
103 | local r1 = f(p) | 103 | local r1 = f(p) |
104 | assert(r == r1 and math.type(r) == math.type(r1)) | 104 | assert(r == r1 and math.type(r) == math.type(r1)) |
105 | check(f, ...) | 105 | check(f, ...) |
@@ -107,7 +107,7 @@ end | |||
107 | 107 | ||
108 | 108 | ||
109 | -- check that 'a' and 'b' has the same opcodes | 109 | -- check that 'a' and 'b' has the same opcodes |
110 | function checkequal (a, b) | 110 | local function checkequal (a, b) |
111 | a = T.listcode(a) | 111 | a = T.listcode(a) |
112 | b = T.listcode(b) | 112 | b = T.listcode(b) |
113 | assert(#a == #b) | 113 | assert(#a == #b) |