diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/gc.lua | 3 | ||||
-rw-r--r-- | testes/locals.lua | 10 |
2 files changed, 2 insertions, 11 deletions
diff --git a/testes/gc.lua b/testes/gc.lua index 03093e34..3c928d7c 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
@@ -460,10 +460,7 @@ do -- tests for string keys in weak tables | |||
460 | a[string.rep("a", 2^22)] = 25 -- long string key -> number value | 460 | a[string.rep("a", 2^22)] = 25 -- long string key -> number value |
461 | a[string.rep("b", 2^22)] = {} -- long string key -> colectable value | 461 | a[string.rep("b", 2^22)] = {} -- long string key -> colectable value |
462 | a[{}] = 14 -- colectable key | 462 | a[{}] = 14 -- colectable key |
463 | assert(collectgarbage("count") > m + 2^13) -- 2^13 == 2 * 2^22 in KB | ||
464 | collectgarbage() | 463 | collectgarbage() |
465 | assert(collectgarbage("count") >= m + 2^12 and | ||
466 | collectgarbage("count") < m + 2^13) -- one key was collected | ||
467 | local k, v = next(a) -- string key with number value preserved | 464 | local k, v = next(a) -- string key with number value preserved |
468 | assert(k == string.rep("a", 2^22) and v == 25) | 465 | assert(k == string.rep("a", 2^22) and v == 25) |
469 | assert(next(a, k) == nil) -- everything else cleared | 466 | assert(next(a, k) == nil) -- everything else cleared |
diff --git a/testes/locals.lua b/testes/locals.lua index 2c48546d..090d846b 100644 --- a/testes/locals.lua +++ b/testes/locals.lua | |||
@@ -728,14 +728,8 @@ if rawget(_G, "T") then | |||
728 | -- first buffer was released by 'toclose' | 728 | -- first buffer was released by 'toclose' |
729 | assert(T.totalmem() - m <= extra) | 729 | assert(T.totalmem() - m <= extra) |
730 | 730 | ||
731 | -- error in creation of final string | 731 | -- userdata, buffer, final string |
732 | T.totalmem(m + 2 * lim + extra) | 732 | T.totalmem(m + 2*lim + extra) |
733 | assert(not pcall(table.concat, a)) | ||
734 | -- second buffer was released by 'toclose' | ||
735 | assert(T.totalmem() - m <= extra) | ||
736 | |||
737 | -- userdata, buffer, buffer, final string | ||
738 | T.totalmem(m + 4*lim + extra) | ||
739 | assert(#table.concat(a) == 2*lim) | 733 | assert(#table.concat(a) == 2*lim) |
740 | 734 | ||
741 | T.totalmem(0) -- remove memory limit | 735 | T.totalmem(0) -- remove memory limit |