mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 10:00:29 +00:00
35 lines
875 B
Lua
35 lines
875 B
Lua
local List = require("harpoon2.list")
|
|
local Config = require("harpoon2.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 = List.decode(config, "foo", {"foo:bar", "baz:qux"})
|
|
local displayed = list:display()
|
|
|
|
eq(displayed, {
|
|
"foo---bar",
|
|
"baz---qux",
|
|
})
|
|
end)
|
|
end)
|
|
|