diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/api.lua | 5 | ||||
-rw-r--r-- | testes/gc.lua | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/testes/api.lua b/testes/api.lua index c1bcb4b7..bd85a923 100644 --- a/testes/api.lua +++ b/testes/api.lua | |||
@@ -804,15 +804,14 @@ F = function (x) | |||
804 | d = nil | 804 | d = nil |
805 | assert(debug.getmetatable(x).__gc == F) | 805 | assert(debug.getmetatable(x).__gc == F) |
806 | assert(load("table.insert({}, {})"))() -- create more garbage | 806 | assert(load("table.insert({}, {})"))() -- create more garbage |
807 | collectgarbage() -- force a GC during GC | 807 | assert(not collectgarbage()) -- GC during GC (no op) |
808 | assert(debug.getmetatable(x).__gc == F) -- previous GC did not mess this? | ||
809 | local dummy = {} -- create more garbage during GC | 808 | local dummy = {} -- create more garbage during GC |
810 | if A ~= nil then | 809 | if A ~= nil then |
811 | assert(type(A) == "userdata") | 810 | assert(type(A) == "userdata") |
812 | assert(T.udataval(A) == B) | 811 | assert(T.udataval(A) == B) |
813 | debug.getmetatable(A) -- just access it | 812 | debug.getmetatable(A) -- just access it |
814 | end | 813 | end |
815 | A = x -- ressucita userdata | 814 | A = x -- ressurect userdata |
816 | B = udval | 815 | B = udval |
817 | return 1,2,3 | 816 | return 1,2,3 |
818 | end | 817 | end |
diff --git a/testes/gc.lua b/testes/gc.lua index 2332c939..d865cb28 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
@@ -676,11 +676,13 @@ end | |||
676 | -- just to make sure | 676 | -- just to make sure |
677 | assert(collectgarbage'isrunning') | 677 | assert(collectgarbage'isrunning') |
678 | 678 | ||
679 | do -- check that the collector is reentrant in incremental mode | 679 | do -- check that the collector is not reentrant in incremental mode |
680 | local res = true | ||
680 | setmetatable({}, {__gc = function () | 681 | setmetatable({}, {__gc = function () |
681 | collectgarbage() | 682 | res = collectgarbage() |
682 | end}) | 683 | end}) |
683 | collectgarbage() | 684 | collectgarbage() |
685 | assert(not res) | ||
684 | end | 686 | end |
685 | 687 | ||
686 | 688 | ||