bootstrap_spec.lua 1.9 KB

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