mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
feat: length 1 to 0 bug
This commit is contained in:
parent
b924b2cb9e
commit
3b8cf0e1ea
@ -14,10 +14,7 @@ local function guess_length(arr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function determine_length(arr, previous_length)
|
local function determine_length(arr, previous_length)
|
||||||
local idx = previous_length
|
local idx = 0
|
||||||
if idx == 1 and arr[idx] == nil then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
for i = previous_length, 1, -1 do
|
for i = previous_length, 1, -1 do
|
||||||
if arr[i] ~= nil then
|
if arr[i] ~= nil then
|
||||||
idx = i
|
idx = i
|
||||||
|
@ -193,6 +193,16 @@ describe("list", function()
|
|||||||
}, list.items)
|
}, list.items)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("remove #653 bug", function()
|
||||||
|
local config = Config.merge_config()
|
||||||
|
local c = Config.get_config(config, "foo")
|
||||||
|
local list = List:new(c, "foo", {
|
||||||
|
{ value = "one" },
|
||||||
|
})
|
||||||
|
list:remove_at(1)
|
||||||
|
eq(0, list:length())
|
||||||
|
end)
|
||||||
|
|
||||||
it("remove_at", function()
|
it("remove_at", function()
|
||||||
local config = Config.merge_config()
|
local config = Config.merge_config()
|
||||||
local c = Config.get_config(config, "foo")
|
local c = Config.get_config(config, "foo")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user