mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: use helpers.pathroot() to avoid a syscall
This commit is contained in:
parent
0578087e5e
commit
41b3c7850f
@ -18,24 +18,18 @@ describe('fnamemodify()', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('works', function()
|
it('works', function()
|
||||||
|
local root = helpers.pathroot()
|
||||||
|
eq(root, fnamemodify([[/]], ':p:h'))
|
||||||
|
eq(root, fnamemodify([[/]], ':p'))
|
||||||
if iswin() then
|
if iswin() then
|
||||||
local drive_f = io.popen('for %P in (%CD%) do @echo %~dP', 'r')
|
|
||||||
local drive = string.gsub(drive_f:read('*a'), '[\n\r]', '')
|
|
||||||
drive_f:close()
|
|
||||||
local root = drive..[[\]]
|
|
||||||
eq(root, fnamemodify([[\]], ':p:h'))
|
eq(root, fnamemodify([[\]], ':p:h'))
|
||||||
eq(root, fnamemodify([[\]], ':p'))
|
eq(root, fnamemodify([[\]], ':p'))
|
||||||
eq(root, fnamemodify([[/]], ':p:h'))
|
|
||||||
eq(root, fnamemodify([[/]], ':p'))
|
|
||||||
command('set shellslash')
|
command('set shellslash')
|
||||||
root = drive..[[/]]
|
root = string.sub(root, 1, -2)..'/'
|
||||||
eq(root, fnamemodify([[\]], ':p:h'))
|
eq(root, fnamemodify([[\]], ':p:h'))
|
||||||
eq(root, fnamemodify([[\]], ':p'))
|
eq(root, fnamemodify([[\]], ':p'))
|
||||||
eq(root, fnamemodify([[/]], ':p:h'))
|
eq(root, fnamemodify([[/]], ':p:h'))
|
||||||
eq(root, fnamemodify([[/]], ':p'))
|
eq(root, fnamemodify([[/]], ':p'))
|
||||||
else
|
|
||||||
eq('/', fnamemodify([[/]], ':p:h'))
|
|
||||||
eq('/', fnamemodify([[/]], ':p'))
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user