mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +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
|
||||
|
||||
local function determine_length(arr, previous_length)
|
||||
local idx = previous_length
|
||||
if idx == 1 and arr[idx] == nil then
|
||||
return 0
|
||||
end
|
||||
local idx = 0
|
||||
for i = previous_length, 1, -1 do
|
||||
if arr[i] ~= nil then
|
||||
idx = i
|
||||
|
@ -193,6 +193,16 @@ describe("list", function()
|
||||
}, list.items)
|
||||
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()
|
||||
local config = Config.merge_config()
|
||||
local c = Config.get_config(config, "foo")
|
||||
|
Loading…
x
Reference in New Issue
Block a user