diff options
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/gengc.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testes/gengc.lua b/testes/gengc.lua index 93b5afd7..3d4f67f8 100644 --- a/testes/gengc.lua +++ b/testes/gengc.lua | |||
| @@ -106,6 +106,23 @@ do -- another bug in 5.4.0 | |||
| 106 | end | 106 | end |
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | do -- bug introduced in commit 9cf3299fa | ||
| 110 | local t = setmetatable({}, {__mode = "kv"}) -- all-weak table | ||
| 111 | collectgarbage() -- full collection | ||
| 112 | assert(not T or T.gcage(t) == "old") | ||
| 113 | t[1] = {10} | ||
| 114 | assert(not T or (T.gcage(t) == "touched1" and T.gccolor(t) == "gray")) | ||
| 115 | collectgarbage("step", 0) -- minor collection | ||
| 116 | assert(not T or (T.gcage(t) == "touched2" and T.gccolor(t) == "black")) | ||
| 117 | collectgarbage("step", 0) -- minor collection | ||
| 118 | assert(not T or T.gcage(t) == "old") -- t should be black, but it was gray | ||
| 119 | t[1] = {10} -- no barrier here, so t was still old | ||
| 120 | collectgarbage("step", 0) -- minor collection | ||
| 121 | -- t, being old, is ignored by the collection, so it is not cleared | ||
| 122 | assert(t[1] == nil) -- fails with the bug | ||
| 123 | end | ||
| 124 | |||
| 125 | |||
| 109 | if T == nil then | 126 | if T == nil then |
| 110 | (Message or print)('\n >>> testC not active: \z | 127 | (Message or print)('\n >>> testC not active: \z |
| 111 | skipping some generational tests <<<\n') | 128 | skipping some generational tests <<<\n') |
