bootstrap_spec.lua 1.8 KB

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