aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/cd_spec.lua
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2017-11-11 03:14:44 -0500
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-02-19 07:10:46 -0500
commitd80bf3c656cc4b64005cbc149a764a5c238203ad (patch)
treed26db5d99a284f5aea25ec313677c5e7537ba48c /test/functional/ex_cmds/cd_spec.lua
parentdf99ab461ee2a515b82b53573de741b6d2024644 (diff)
downloadrneovim-d80bf3c656cc4b64005cbc149a764a5c238203ad.tar.gz
rneovim-d80bf3c656cc4b64005cbc149a764a5c238203ad.tar.bz2
rneovim-d80bf3c656cc4b64005cbc149a764a5c238203ad.zip
test: enable ex_cmds/cd_spec.lua on Windows
Diffstat (limited to 'test/functional/ex_cmds/cd_spec.lua')
-rw-r--r--test/functional/ex_cmds/cd_spec.lua47
1 files changed, 25 insertions, 22 deletions
diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua
index 059cb26d5d..d45f46ed3d 100644
--- a/test/functional/ex_cmds/cd_spec.lua
+++ b/test/functional/ex_cmds/cd_spec.lua
@@ -8,8 +8,7 @@ local call = helpers.call
local clear = helpers.clear
local command = helpers.command
local exc_exec = helpers.exc_exec
-
-if helpers.pending_win32(pending) then return end
+local pathsep = helpers.get_pathsep()
-- These directories will be created for testing
local directories = {
@@ -75,8 +74,8 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(globalwin, tabnr))
-- Window with local dir reports as such
- eq(globalDir .. '/' .. directories.window, cwd(localwin))
- eq(globalDir .. '/' .. directories.window, cwd(localwin, tabnr))
+ eq(globalDir .. pathsep .. directories.window, cwd(localwin))
+ eq(globalDir .. pathsep .. directories.window, cwd(localwin, tabnr))
eq(1, lwd(localwin))
eq(1, lwd(localwin, tabnr))
@@ -86,7 +85,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(globalwin, tabnr))
-- From new tab page, local window reports as such
- eq(globalDir .. '/' .. directories.window, cwd(localwin, tabnr))
+ eq(globalDir .. pathsep .. directories.window, cwd(localwin, tabnr))
eq(1, lwd(localwin, tabnr))
end)
@@ -109,14 +108,14 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(-1, globaltab))
-- new tab reports local
- eq(globalDir .. '/' .. directories.tab, cwd(-1, 0))
- eq(globalDir .. '/' .. directories.tab, cwd(-1, localtab))
+ eq(globalDir .. pathsep .. directories.tab, cwd(-1, 0))
+ eq(globalDir .. pathsep .. directories.tab, cwd(-1, localtab))
eq(1, lwd(-1, 0))
eq(1, lwd(-1, localtab))
command('tabnext')
-- From original tab page, local reports as such
- eq(globalDir .. '/' .. directories.tab, cwd(-1, localtab))
+ eq(globalDir .. pathsep .. directories.tab, cwd(-1, localtab))
eq(1, lwd(-1, localtab))
end)
end)
@@ -147,17 +146,17 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- Create a new tab and change directory
command('tabnew')
command('silent t' .. cmd .. ' ' .. directories.tab)
- eq(globalDir .. '/' .. directories.tab, tcwd())
+ eq(globalDir .. pathsep .. directories.tab, tcwd())
-- Create a new tab and verify it has inherited the directory
command('tabnew')
- eq(globalDir .. '/' .. directories.tab, tcwd())
+ eq(globalDir .. pathsep .. directories.tab, tcwd())
-- Change tab and change back, verify that directories are correct
command('tabnext')
eq(globalDir, tcwd())
command('tabprevious')
- eq(globalDir .. '/' .. directories.tab, tcwd())
+ eq(globalDir .. pathsep .. directories.tab, tcwd())
end)
end)
@@ -173,7 +172,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- Change tab-local working directory and verify it is different
command('silent t' .. cmd .. ' ' .. directories.tab)
- eq(globalDir .. '/' .. directories.tab, cwd())
+ eq(globalDir .. pathsep .. directories.tab, cwd())
eq(cwd(), tcwd()) -- working directory maches tab directory
eq(1, tlwd())
eq(cwd(), wcwd()) -- still no window-directory
@@ -183,16 +182,16 @@ for _, cmd in ipairs {'cd', 'chdir'} do
command('new')
eq(1, tlwd()) -- Still tab-local working directory
eq(0, wlwd()) -- Still no window-local working directory
- eq(globalDir .. '/' .. directories.tab, cwd())
+ eq(globalDir .. pathsep .. directories.tab, cwd())
command('silent l' .. cmd .. ' ../' .. directories.window)
- eq(globalDir .. '/' .. directories.window, cwd())
- eq(globalDir .. '/' .. directories.tab, tcwd())
+ eq(globalDir .. pathsep .. directories.window, cwd())
+ eq(globalDir .. pathsep .. directories.tab, tcwd())
eq(1, wlwd())
-- Verify the first window still has the tab local directory
command('wincmd w')
- eq(globalDir .. '/' .. directories.tab, cwd())
- eq(globalDir .. '/' .. directories.tab, tcwd())
+ eq(globalDir .. pathsep .. directories.tab, cwd())
+ eq(globalDir .. pathsep .. directories.tab, tcwd())
eq(0, wlwd()) -- No window-local directory
-- Change back to initial tab and verify working directory has stayed
@@ -203,10 +202,10 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- Verify global changes don't affect local ones
command('silent ' .. cmd .. ' ' .. directories.global)
- eq(globalDir .. '/' .. directories.global, cwd())
+ eq(globalDir .. pathsep .. directories.global, cwd())
command('tabnext')
- eq(globalDir .. '/' .. directories.tab, cwd())
- eq(globalDir .. '/' .. directories.tab, tcwd())
+ eq(globalDir .. pathsep .. directories.tab, cwd())
+ eq(globalDir .. pathsep .. directories.tab, tcwd())
eq(0, wlwd()) -- Still no window-local directory in this window
-- Unless the global change happened in a tab with local directory
@@ -220,9 +219,9 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- But not in a window with its own local directory
command('tabnext | wincmd w')
- eq(globalDir .. '/' .. directories.window, cwd() )
+ eq(globalDir .. pathsep .. directories.window, cwd() )
eq(0 , tlwd())
- eq(globalDir .. '/' .. directories.window, wcwd())
+ eq(globalDir .. pathsep .. directories.window, wcwd())
end)
end)
end
@@ -280,6 +279,10 @@ describe("getcwd()", function ()
end)
it("returns empty string if working directory does not exist", function()
+ if helpers.iswin() then
+ pending('[Cannot delete working directory in Windows]')
+ return
+ end
command("cd "..directories.global)
command("call delete('../"..directories.global.."', 'd')")
eq("", helpers.eval("getcwd()"))