diff options
Diffstat (limited to 'testes/gc.lua')
-rw-r--r-- | testes/gc.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testes/gc.lua b/testes/gc.lua index 96eadad8..0693837c 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
@@ -601,6 +601,21 @@ end | |||
601 | 601 | ||
602 | 602 | ||
603 | if T then | 603 | if T then |
604 | collectgarbage("stop") | ||
605 | T.gcstate("pause") | ||
606 | local sup = {x = 0} | ||
607 | local a = setmetatable({}, {__newindex = sup}) | ||
608 | T.gcstate("enteratomic") | ||
609 | assert(T.gccolor(sup) == "black") | ||
610 | a.x = {} -- should not break the invariant | ||
611 | assert(not (T.gccolor(sup) == "black" and T.gccolor(sup.x) == "white")) | ||
612 | T.gcstate("pause") -- complete the GC cycle | ||
613 | sup.x.y = 10 | ||
614 | collectgarbage("restart") | ||
615 | end | ||
616 | |||
617 | |||
618 | if T then | ||
604 | print("emergency collections") | 619 | print("emergency collections") |
605 | collectgarbage() | 620 | collectgarbage() |
606 | collectgarbage() | 621 | collectgarbage() |