aboutsummaryrefslogtreecommitdiff
path: root/testes/all.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-03-01 13:54:29 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-03-01 13:54:29 -0300
commit5276973224066e591b0f1a79c3b091d395848ac4 (patch)
treee72f167dca7796b4014b1833cb1e9eaed58a623e /testes/all.lua
parentf9d857a81b87b695c1e3b34f1e7fe55884d1288f (diff)
downloadlua-5276973224066e591b0f1a79c3b091d395848ac4.tar.gz
lua-5276973224066e591b0f1a79c3b091d395848ac4.tar.bz2
lua-5276973224066e591b0f1a79c3b091d395848ac4.zip
New test module 'tracegc'
New module easies the inclusion of GC tracing in individual test files.
Diffstat (limited to 'testes/all.lua')
-rw-r--r--testes/all.lua14
1 files changed, 2 insertions, 12 deletions
diff --git a/testes/all.lua b/testes/all.lua
index a4feeec1..a8e44024 100644
--- a/testes/all.lua
+++ b/testes/all.lua
@@ -154,18 +154,8 @@ end
154 154
155dofile('main.lua') 155dofile('main.lua')
156 156
157do 157-- trace GC cycles
158 local next, setmetatable, stderr = next, setmetatable, io.stderr 158require"tracegc".start()
159 -- track collections
160 local mt = {}
161 -- each time a table is collected, remark it for finalization
162 -- on next cycle
163 mt.__gc = function (o)
164 stderr:write'.' -- mark progress
165 local n = setmetatable(o, mt) -- remark it
166 end
167 local n = setmetatable({}, mt) -- create object
168end
169 159
170report"gc.lua" 160report"gc.lua"
171local f = assert(loadfile('gc.lua')) 161local f = assert(loadfile('gc.lua'))