bootstrap_spec.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. local a = require "plenary.async_lib.tests"
  2. local uv = vim.loop
  3. local home_dir = uv.os_homedir()
  4. a.describe("initial start", function()
  5. local lvim_config_path = get_config_dir()
  6. local lvim_runtime_path = get_runtime_dir()
  7. local lvim_cache_path = get_cache_dir()
  8. a.it("should be able to detect test environment", function()
  9. assert.truthy(os.getenv "LVIM_TEST_ENV")
  10. assert.falsy(package.loaded["lvim.impatient"])
  11. end)
  12. a.it("should be able to use lunarvim cache directory using vim.fn", function()
  13. assert.equal(lvim_cache_path, vim.fn.stdpath "cache")
  14. end)
  15. a.it("should be to retrieve default neovim directories", function()
  16. local xdg_config = os.getenv "XDG_CONFIG_HOME" or join_paths(home_dir, ".config")
  17. assert.equal(join_paths(xdg_config, "nvim"), vim.call("stdpath", "config"))
  18. end)
  19. a.it("should be able to read lunarvim directories", function()
  20. local rtp_list = vim.opt.rtp:get()
  21. assert.truthy(vim.tbl_contains(rtp_list, lvim_runtime_path .. "/lvim"))
  22. assert.truthy(vim.tbl_contains(rtp_list, lvim_config_path))
  23. end)
  24. a.it("should be able to run treesitter without errors", function()
  25. assert.truthy(vim.treesitter.highlighter.active)
  26. end)
  27. a.it("should be able to pass basic checkhealth without errors", function()
  28. vim.cmd "set cmdheight&"
  29. vim.cmd "checkhealth nvim"
  30. local errmsg = vim.fn.eval "v:errmsg"
  31. local exception = vim.fn.eval "v:exception"
  32. assert.equal("", errmsg) -- v:errmsg was not updated.
  33. assert.equal("", exception)
  34. end)
  35. end)