Skip to content

Commit 83da730

Browse files
committed
tmp
1 parent 9627cdc commit 83da730

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tests/lapi/table_remove_test.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,18 @@ local function TestOneInput(buf, _size)
2323
str:gsub(".", function(c)
2424
table.insert(tbl, c)
2525
end)
26-
for _ = 1, #tbl do
27-
assert(tbl[1] == table.remove(tbl, 1))
26+
-- for _ = 1, #tbl do
27+
-- assert(tbl[1] == table.remove(tbl, 1))
28+
-- end
29+
-- assert(#tbl == 0)
30+
31+
for i = 1, #tbl do -- #t == #idx
32+
local old_l = #tbl
33+
local idx = idx[i] > old_l and old_l or idx[i] -- only actual indexes
34+
local old_v = t[idx]
35+
assert(table.remove(t, idx) == old_v)
36+
assert(t[old_l] == nil)
2837
end
29-
assert(#tbl == 0)
3038
end
3139

3240
local args = {

0 commit comments

Comments
 (0)