|
@@ -1,5 +1,6 @@
|
|
local a = require "plenary.async_lib.tests"
|
|
local a = require "plenary.async_lib.tests"
|
|
local config = require "lvim.config"
|
|
local config = require "lvim.config"
|
|
|
|
+local utils = require "lvim.utils"
|
|
|
|
|
|
a.describe("config-loader", function()
|
|
a.describe("config-loader", function()
|
|
local user_config_path = config:get_user_config_path()
|
|
local user_config_path = config:get_user_config_path()
|
|
@@ -20,18 +21,19 @@ a.describe("config-loader", function()
|
|
vim.opt.undodir = "/tmp"
|
|
vim.opt.undodir = "/tmp"
|
|
assert.equal(vim.opt.undodir:get()[1], "/tmp")
|
|
assert.equal(vim.opt.undodir:get()[1], "/tmp")
|
|
config:reload()
|
|
config:reload()
|
|
- assert.equal(vim.opt.undodir:get()[1], get_cache_dir() .. "/undo")
|
|
|
|
|
|
+ assert.equal(vim.opt.undodir:get()[1], utils.join_paths(get_cache_dir(), "undo"))
|
|
end)
|
|
end)
|
|
|
|
|
|
a.it("should not get interrupted by errors in user-config", function()
|
|
a.it("should not get interrupted by errors in user-config", function()
|
|
vim.opt.undodir = "/tmp"
|
|
vim.opt.undodir = "/tmp"
|
|
assert.equal(vim.opt.undodir:get()[1], "/tmp")
|
|
assert.equal(vim.opt.undodir:get()[1], "/tmp")
|
|
- os.execute("echo bad_string_test >> " .. user_config_path)
|
|
|
|
|
|
+ os.execute(string.format("echo 'bad_string_test' >> %s", user_config_path))
|
|
local error_handler = function(msg)
|
|
local error_handler = function(msg)
|
|
return msg
|
|
return msg
|
|
end
|
|
end
|
|
local err = xpcall(config:reload(), error_handler)
|
|
local err = xpcall(config:reload(), error_handler)
|
|
assert.falsy(err)
|
|
assert.falsy(err)
|
|
- assert.equal(vim.opt.undodir:get()[1], get_cache_dir() .. "/undo")
|
|
|
|
|
|
+ assert.equal(vim.opt.undodir:get()[1], utils.join_paths(get_cache_dir(), "undo"))
|
|
|
|
+ os.execute(string.format("echo '' > %s", user_config_path))
|
|
end)
|
|
end)
|
|
end)
|
|
end)
|