test: select with nil

This commit is contained in:
Michael Paulson 2023-12-01 15:51:50 -07:00
parent c131b4b61b
commit 8dd3d909fd

View File

@ -30,4 +30,34 @@ describe("list", function()
"baz---qux",
})
end)
it("select_with_nil", function()
local foo_selected = nil
local bar_selected = nil
local config = Config.merge_config({
foo = {
select_with_nil = true,
select = function (list_item, options)
foo_selected = {list_item, options}
end
},
bar = {
select = function (list_item, options)
bar_selected = {list_item, options}
end
}
})
local fooc = Config.get_config(config, "foo")
local barc = Config.get_config(config, "bar")
local foo = List.decode(fooc, "foo", {})
local bar = List.decode(fooc, "bar", {})
foo:select(4, {})
bar:select(4, {})
eq({nil, {}}, foo_selected)
eq(nil, bar_selected)
end)
end)