aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-07-18 14:58:15 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-07-18 14:58:15 -0300
commitd36a31e6739bcd39c84f637344227af87cfd0ee5 (patch)
tree68b0049215b0b6cf2a8109e24cb154175bf02c4d /testes
parent024a6071cac749504e0b26a915bda4f52c41a892 (diff)
downloadlua-d36a31e6739bcd39c84f637344227af87cfd0ee5.tar.gz
lua-d36a31e6739bcd39c84f637344227af87cfd0ee5.tar.bz2
lua-d36a31e6739bcd39c84f637344227af87cfd0ee5.zip
Reviving HARDMEMTESTS
This commit brings a new implementation for HARDMEMTESTS, which forces an emergency GC whenever possible. It also fixes some issues detected with this option: - A small bug in lvm.c: a closure could be collected by an emergency GC while being initialized. - Some tests: a memory address can be immediatly reused after a GC; for instance, two consecutive '{}' expressions can return exactly the same address, if the first one is not anchored.
Diffstat (limited to 'testes')
-rw-r--r--testes/api.lua7
-rw-r--r--testes/strings.lua11
2 files changed, 13 insertions, 5 deletions
diff --git a/testes/api.lua b/testes/api.lua
index 8f4e89ac..5da03641 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -354,8 +354,11 @@ assert(to("topointer", nil) == null)
354assert(to("topointer", "abc") ~= null) 354assert(to("topointer", "abc") ~= null)
355assert(to("topointer", string.rep("x", 10)) == 355assert(to("topointer", string.rep("x", 10)) ==
356 to("topointer", string.rep("x", 10))) -- short strings 356 to("topointer", string.rep("x", 10))) -- short strings
357assert(to("topointer", string.rep("x", 300)) ~= 357do -- long strings
358 to("topointer", string.rep("x", 300))) -- long strings 358 local s1 = string.rep("x", 300)
359 local s2 = string.rep("x", 300)
360 assert(to("topointer", s1) ~= to("topointer", s2))
361end
359assert(to("topointer", T.pushuserdata(20)) ~= null) 362assert(to("topointer", T.pushuserdata(20)) ~= null)
360assert(to("topointer", io.read) ~= null) -- light C function 363assert(to("topointer", io.read) ~= null) -- light C function
361assert(to("topointer", hfunc) ~= null) -- "heavy" C function 364assert(to("topointer", hfunc) ~= null) -- "heavy" C function
diff --git a/testes/strings.lua b/testes/strings.lua
index 1b2b570e..2540fdef 100644
--- a/testes/strings.lua
+++ b/testes/strings.lua
@@ -163,11 +163,16 @@ do -- tests for '%p' format
163 assert(string.format("%p", 4) == null) 163 assert(string.format("%p", 4) == null)
164 assert(string.format("%p", print) ~= null) 164 assert(string.format("%p", print) ~= null)
165 assert(string.format("%p", coroutine.running()) ~= null) 165 assert(string.format("%p", coroutine.running()) ~= null)
166 assert(string.format("%p", {}) ~= string.format("%p", {})) 166 do
167 local t1 = {}; local t2 = {}
168 assert(string.format("%p", t1) ~= string.format("%p", t2))
169 end
167 assert(string.format("%p", string.rep("a", 10)) == 170 assert(string.format("%p", string.rep("a", 10)) ==
168 string.format("%p", string.rep("a", 10))) -- short strings 171 string.format("%p", string.rep("a", 10))) -- short strings
169 assert(string.format("%p", string.rep("a", 300)) ~= 172 do -- long strings
170 string.format("%p", string.rep("a", 300))) -- long strings 173 local s1 = string.rep("a", 300); local s2 = string.rep("a", 300)
174 assert(string.format("%p", s1) ~= string.format("%p", s2))
175 end
171 assert(#string.format("%90p", {}) == 90) 176 assert(#string.format("%90p", {}) == 90)
172end 177end
173 178