test(vim.fs.normalize): enable test on Windows

This commit is contained in:
dundargoc 2023-04-05 23:56:33 +02:00 committed by GitHub
parent 2dfb51a2be
commit fd32a98752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -271,10 +271,11 @@ describe('vim.fs', function()
eq('C:/Users/jdoe', exec_lua [[ return vim.fs.normalize('C:\\Users\\jdoe') ]]) eq('C:/Users/jdoe', exec_lua [[ return vim.fs.normalize('C:\\Users\\jdoe') ]])
end) end)
it('works with ~', function() it('works with ~', function()
if is_os('win') then eq( exec_lua([[
pending([[$HOME does not exist on Windows ¯\_(ツ)_/¯]]) local home = ...
end return home .. '/src/foo'
eq(os.getenv('HOME') .. '/src/foo', exec_lua [[ return vim.fs.normalize('~/src/foo') ]]) ]], is_os('win') and vim.fs.normalize(os.getenv('USERPROFILE')) or os.getenv('HOME')
) , exec_lua [[ return vim.fs.normalize('~/src/foo') ]])
end) end)
it('works with environment variables', function() it('works with environment variables', function()
local xdg_config_home = test_build_dir .. '/.config' local xdg_config_home = test_build_dir .. '/.config'