1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:20:04 +08:00
SpaceVim/bundle/cmp-dictionary/lua/cmp_dictionary/init_spec.lua
2023-06-11 21:41:39 +08:00

35 lines
887 B
Lua

local main = require("cmp_dictionary")
local function dictionary()
return vim.opt_local.dictionary:get()
end
describe("Test for init.lua", function()
before_each(function()
vim.opt_local.dictionary = {}
end)
describe("switcher", function()
describe("filetype", function()
it("single dictionary", function()
main.switcher({
filetype = {
lua = "/path/to/lua.dict",
},
})
vim.opt.filetype = "lua"
assert.are.same({ "/path/to/lua.dict" }, dictionary())
end)
it("multi dictionaries", function()
main.switcher({
filetype = {
javascript = { "/path/to/js.dict", "/path/to/js2.dict" },
},
})
vim.opt.filetype = "javascript"
assert.are.same({ "/path/to/js.dict", "/path/to/js2.dict" }, dictionary())
end)
end)
end)
end)