File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,15 @@ do --- rechain
28
28
29
29
assert (t [k ] == 4 )
30
30
end
31
+
32
+ do --- TSETM gc
33
+ local function f ()
34
+ collectgarbage ()
35
+ return " a" , " b"
36
+ end
37
+ for i = 1 , 10 do
38
+ local t = {f ()}
39
+ assert (t [1 ] == " a" )
40
+ assert (t [2 ] == " b" )
41
+ end
42
+ end
Original file line number Diff line number Diff line change @@ -21,3 +21,22 @@ do --- table.remove(t, 1) removes and returns the first entry
21
21
for i = 1 ,100 do assert (tremove (t , 1 ) == i ) end
22
22
assert (# t == 100 and t [100 ] == 200 )
23
23
end
24
+
25
+ do --- TSETR hash part +table.new
26
+ local tnew = require " table.new"
27
+ local t = tnew (0 , 16 )
28
+ for i = 10 ,1 ,- 1 do t [i ] = i + 3 end
29
+ for i = 10 ,1 ,- 1 do assert (tremove (t ) == i + 3 ) end
30
+ assert (# t == 0 )
31
+ end
32
+
33
+ do --- TSETR write barrier +table.new
34
+ local tnew = require " table.new"
35
+ for _ , t in ipairs {{}, tnew (0 , 16 )} do
36
+ for i = 1 , 10 do t [i ] = {i } end
37
+ for i = 1 , 10 do
38
+ collectgarbage ()
39
+ assert (tremove (t , 1 )[1 ] == i )
40
+ end
41
+ end
42
+ end
You can’t perform that action at this time.
0 commit comments