diff --git a/lua/harpoon/test/list_spec.lua b/lua/harpoon/test/list_spec.lua index 476ad31..f590459 100644 --- a/lua/harpoon/test/list_spec.lua +++ b/lua/harpoon/test/list_spec.lua @@ -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)