patch 8.1.2278: using "cd" with "exe" may fail
Problem: Using "cd" with "exe" may fail.
Solution: Use chdir() instead.
diff --git a/src/testdir/test_cd.vim b/src/testdir/test_cd.vim
index c3589b4..bdb26cd 100644
--- a/src/testdir/test_cd.vim
+++ b/src/testdir/test_cd.vim
@@ -9,7 +9,7 @@
let path = getcwd()
cd ..
call assert_notequal(path, getcwd())
- exe 'cd ' . path
+ exe 'cd ' .. fnameescape(path)
call assert_equal(path, getcwd())
endfunc
@@ -20,7 +20,7 @@
cd
call assert_equal($HOME, getcwd())
call assert_notequal(path, getcwd())
- exe 'cd ' . path
+ exe 'cd ' .. fnameescape(path)
call assert_equal(path, getcwd())
else
" Test that cd without argument echoes cwd on non-Unix systems.
@@ -58,7 +58,7 @@
" :cd should succeed when buffer has been written.
w!
- exe 'cd ' . path
+ exe 'cd ' .. fnameescape(path)
call assert_equal(path, getcwd())
call delete('Xfoo')
@@ -103,6 +103,6 @@
call assert_equal("", d)
only | tabonly
- exe 'cd ' . topdir
+ call chdir(topdir)
call delete('Xdir', 'rf')
endfunc