2021-09-09 18:53:21 +02:00
|
|
|
local a = require "plenary.async_lib.tests"
|
2022-04-20 13:22:26 +02:00
|
|
|
local uv = vim.loop
|
|
|
|
local home_dir = uv.os_homedir()
|
2021-09-09 18:53:21 +02:00
|
|
|
|
|
|
|
a.describe("initial start", function()
|
2022-04-20 13:22:26 +02:00
|
|
|
local lvim_config_path = get_config_dir()
|
|
|
|
local lvim_runtime_path = get_runtime_dir()
|
|
|
|
local lvim_cache_path = get_cache_dir()
|
2021-09-13 11:28:15 +02:00
|
|
|
|
2022-02-18 15:17:17 +01:00
|
|
|
a.it("should be able to detect test environment", function()
|
2021-09-13 11:28:15 +02:00
|
|
|
assert.truthy(os.getenv "LVIM_TEST_ENV")
|
2021-10-10 21:07:41 +02:00
|
|
|
assert.falsy(package.loaded["lvim.impatient"])
|
2021-09-13 11:28:15 +02:00
|
|
|
end)
|
2021-09-09 18:53:21 +02:00
|
|
|
|
2022-04-20 13:22:26 +02:00
|
|
|
a.it("should be able to use lunarvim directories using vim.fn", function()
|
|
|
|
assert.equal(lvim_runtime_path, vim.fn.stdpath "data")
|
|
|
|
assert.equal(lvim_config_path, vim.fn.stdpath "config")
|
|
|
|
assert.equal(lvim_cache_path, vim.fn.stdpath "cache")
|
|
|
|
end)
|
|
|
|
|
|
|
|
a.it("should be to retrieve default neovim directories", function()
|
|
|
|
local xdg_config = os.getenv "XDG_CONFIG_HOME" or join_paths(home_dir, ".config")
|
|
|
|
assert.equal(join_paths(xdg_config, "nvim"), vim.call("stdpath", "config"))
|
2021-09-09 18:53:21 +02:00
|
|
|
end)
|
|
|
|
|
|
|
|
a.it("should be able to read lunarvim directories", function()
|
|
|
|
local rtp_list = vim.opt.rtp:get()
|
2021-09-13 11:28:15 +02:00
|
|
|
assert.truthy(vim.tbl_contains(rtp_list, lvim_runtime_path .. "/lvim"))
|
2021-09-09 18:53:21 +02:00
|
|
|
assert.truthy(vim.tbl_contains(rtp_list, lvim_config_path))
|
|
|
|
end)
|
|
|
|
|
|
|
|
a.it("should be able to run treesitter without errors", function()
|
|
|
|
assert.truthy(vim.treesitter.highlighter.active)
|
|
|
|
end)
|
2021-11-02 16:58:55 +01:00
|
|
|
|
|
|
|
a.it("should be able to pass basic checkhealth without errors", function()
|
2022-01-04 09:47:59 +01:00
|
|
|
vim.cmd "set cmdheight&"
|
2021-11-02 16:58:55 +01:00
|
|
|
vim.cmd "checkhealth nvim"
|
|
|
|
local errmsg = vim.fn.eval "v:errmsg"
|
|
|
|
local exception = vim.fn.eval "v:exception"
|
|
|
|
assert.equal("", errmsg) -- v:errmsg was not updated.
|
|
|
|
assert.equal("", exception)
|
|
|
|
end)
|
2021-09-09 18:53:21 +02:00
|
|
|
end)
|