aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-01-29 00:05:25 -0500
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-01-29 00:05:35 -0500
commit41b3c7850f839b46affe35bf2de92bc18113b0f7 (patch)
treee1daa4e16fb17d7eef188fcb8acd6f99ef01fa74
parent0578087e5ec928e89643f97fc0b82ed8363e4e09 (diff)
downloadrneovim-41b3c7850f839b46affe35bf2de92bc18113b0f7.tar.gz
rneovim-41b3c7850f839b46affe35bf2de92bc18113b0f7.tar.bz2
rneovim-41b3c7850f839b46affe35bf2de92bc18113b0f7.zip
test: use helpers.pathroot() to avoid a syscall
-rw-r--r--test/functional/eval/fnamemodify_spec.lua14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/functional/eval/fnamemodify_spec.lua b/test/functional/eval/fnamemodify_spec.lua
index 52dfe1a55f..fe6b50a544 100644
--- a/test/functional/eval/fnamemodify_spec.lua
+++ b/test/functional/eval/fnamemodify_spec.lua
@@ -18,24 +18,18 @@ describe('fnamemodify()', function()
end)
it('works', function()
+ local root = helpers.pathroot()
+ eq(root, fnamemodify([[/]], ':p:h'))
+ eq(root, fnamemodify([[/]], ':p'))
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'))
- eq(root, fnamemodify([[/]], ':p:h'))
- eq(root, fnamemodify([[/]], ':p'))
command('set shellslash')
- root = drive..[[/]]
+ root = string.sub(root, 1, -2)..'/'
eq(root, fnamemodify([[\]], ':p:h'))
eq(root, fnamemodify([[\]], ':p'))
eq(root, fnamemodify([[/]], ':p:h'))
eq(root, fnamemodify([[/]], ':p'))
- else
- eq('/', fnamemodify([[/]], ':p:h'))
- eq('/', fnamemodify([[/]], ':p'))
end
end)