aboutsummaryrefslogtreecommitdiff
path: root/testes/main.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-04 16:40:18 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-07-04 16:40:18 -0300
commitbfcf06d91a87b7ffb8c83e290db0cb6176a167f8 (patch)
tree0bcba905a2772e536c845e39e9eeed0c7330312c /testes/main.lua
parent0280407fc54f9b6225139c5ac27326f98f0cf043 (diff)
downloadlua-bfcf06d91a87b7ffb8c83e290db0cb6176a167f8.tar.gz
lua-bfcf06d91a87b7ffb8c83e290db0cb6176a167f8.tar.bz2
lua-bfcf06d91a87b7ffb8c83e290db0cb6176a167f8.zip
Avoid memory allocation in some functions from 'ltests.c'
To allow their use in memory tests, some functions in 'ltests.c' should never allocate memory. To avoid this allocation, the library registers the strings used for status codes, and keeps the variable '_WARN' always defined (with false instead of nil).
Diffstat (limited to 'testes/main.lua')
-rw-r--r--testes/main.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/testes/main.lua b/testes/main.lua
index de14a088..d2d602de 100644
--- a/testes/main.lua
+++ b/testes/main.lua
@@ -393,12 +393,12 @@ if T then -- test library?
393 -- testing 'warn' 393 -- testing 'warn'
394 warn("@store") 394 warn("@store")
395 warn("@123", "456", "789") 395 warn("@123", "456", "789")
396 assert(_WARN == "@123456789"); _WARN = nil 396 assert(_WARN == "@123456789"); _WARN = false
397 397
398 warn("zip", "", " ", "zap") 398 warn("zip", "", " ", "zap")
399 assert(_WARN == "zip zap"); _WARN = nil 399 assert(_WARN == "zip zap"); _WARN = false
400 warn("ZIP", "", " ", "ZAP") 400 warn("ZIP", "", " ", "ZAP")
401 assert(_WARN == "ZIP ZAP"); _WARN = nil 401 assert(_WARN == "ZIP ZAP"); _WARN = false
402 warn("@normal") 402 warn("@normal")
403end 403end
404 404