aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/fs_spec.lua
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2022-05-17 08:49:33 -0600
committerGregory Anders <greg@gpanders.com>2022-05-31 13:30:10 -0600
commit046b4ed461cb78b8b302a6403cc7ea64ad6b6085 (patch)
tree9409d824661880a0abdc289b5933c930d4eafae4 /test/functional/lua/fs_spec.lua
parentf271d706611049bc53a6a439b310fe60bf0fab13 (diff)
downloadrneovim-046b4ed461cb78b8b302a6403cc7ea64ad6b6085.tar.gz
rneovim-046b4ed461cb78b8b302a6403cc7ea64ad6b6085.tar.bz2
rneovim-046b4ed461cb78b8b302a6403cc7ea64ad6b6085.zip
feat(fs): add vim.fs.normalize()
Diffstat (limited to 'test/functional/lua/fs_spec.lua')
-rw-r--r--test/functional/lua/fs_spec.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua
index 204bdc1567..2bcc84db0f 100644
--- a/test/functional/lua/fs_spec.lua
+++ b/test/functional/lua/fs_spec.lua
@@ -79,4 +79,23 @@ describe('vim.fs', function()
]], test_build_dir, nvim_prog_basename))
end)
end)
+
+ describe('normalize()', function()
+ it('works with backward slashes', function()
+ eq('C:/Users/jdoe', exec_lua [[ return vim.fs.normalize('C:\\Users\\jdoe') ]])
+ end)
+ it('works with ~', function()
+ if iswin() then
+ pending([[$HOME does not exist on Windows ¯\_(ツ)_/¯]])
+ end
+ eq(os.getenv('HOME') .. '/src/foo', exec_lua [[ return vim.fs.normalize('~/src/foo') ]])
+ end)
+ it('works with environment variables', function()
+ local xdg_config_home = test_build_dir .. '/.config'
+ eq(xdg_config_home .. '/nvim', exec_lua([[
+ vim.env.XDG_CONFIG_HOME = ...
+ return vim.fs.normalize('$XDG_CONFIG_HOME/nvim')
+ ]], xdg_config_home))
+ end)
+ end)
end)