mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 18:10:28 +00:00
34 lines
941 B
Lua
34 lines
941 B
Lua
local List = require("harpoon.list")
|
|
local Config = require("harpoon.config")
|
|
local eq = assert.are.same
|
|
|
|
describe("list", function()
|
|
it("decode", function()
|
|
local config = Config.merge_config({
|
|
foo = {
|
|
decode = function(item)
|
|
-- split item on :
|
|
local parts = vim.split(item, ":")
|
|
return {
|
|
value = parts,
|
|
context = nil,
|
|
}
|
|
end,
|
|
|
|
display = function(item)
|
|
return table.concat(item.value, "---")
|
|
end,
|
|
},
|
|
})
|
|
local list_config = Config.get_config(config, "foo")
|
|
|
|
local list = List.decode(list_config, "foo", { "foo:bar", "baz:qux" })
|
|
local displayed = list:display()
|
|
|
|
eq(displayed, {
|
|
"foo---bar",
|
|
"baz---qux",
|
|
})
|
|
end)
|
|
end)
|