mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
unittests: Add tests for tv_list_idx_of_item
This commit is contained in:
@@ -1324,5 +1324,21 @@ describe('typval.c', function()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
describe('idx_of_item()', function()
|
||||
it('works', function()
|
||||
local l = list(1, 2, 3, 4, 5)
|
||||
local l2 = list(42, empty_list)
|
||||
local lis = list_items(l)
|
||||
local lis2 = list_items(l2)
|
||||
|
||||
for i, li in ipairs(lis) do
|
||||
eq(i - 1, lib.tv_list_idx_of_item(l, li))
|
||||
end
|
||||
eq(-1, lib.tv_list_idx_of_item(l, lis2[1]))
|
||||
eq(-1, lib.tv_list_idx_of_item(l, nil))
|
||||
eq(-1, lib.tv_list_idx_of_item(nil, nil))
|
||||
eq(-1, lib.tv_list_idx_of_item(nil, lis[1]))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user