summaryrefslogtreecommitdiff
path: root/testes/math.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-12-28 18:34:11 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-12-28 18:34:11 -0300
commit314745ed8438d1276c6c928d5f9d4be018dfadb6 (patch)
tree594b7e873f2c29113d95c75147ab10865cdd772c /testes/math.lua
parent0825cf237d9d3505155f8b40bcf83ea1b135e8da (diff)
downloadlua-github-314745ed8438d1276c6c928d5f9d4be018dfadb6.tar.gz
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/math.lua')
-rw-r--r--testes/math.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/testes/math.lua b/testes/math.lua
index 48c1efe1..0191f7dd 100644
--- a/testes/math.lua
+++ b/testes/math.lua
@@ -50,7 +50,7 @@ end
local msgf2i = "number.* has no integer representation"
-- float equality
-function eq (a,b,limit)
+local function eq (a,b,limit)
if not limit then
if floatbits >= 50 then limit = 1E-11
else limit = 1E-5
@@ -62,7 +62,7 @@ end
-- equality with types
-function eqT (a,b)
+local function eqT (a,b)
return a == b and math.type(a) == math.type(b)
end
@@ -83,7 +83,7 @@ end
do
local x = -1
local mz = 0/x -- minus zero
- t = {[0] = 10, 20, 30, 40, 50}
+ local t = {[0] = 10, 20, 30, 40, 50}
assert(t[mz] == t[0] and t[-0] == t[0])
end