summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-09 20:10:17 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-09 20:10:17 +0100
commit3503d7c94a6c8c2a5ca1665d648d0cb81afcc863 (patch)
tree1084785735f6ed7f60ef12045d016977ae92c377 /src/testdir/test_autocmd.vim
parentb73e439606b55d66d9e81da1f9cae729af37cf04 (diff)
patch 8.1.2278: using "cd" with "exe" may failv8.1.2278
Problem: Using "cd" with "exe" may fail. Solution: Use chdir() instead.
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r--src/testdir/test_autocmd.vim16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 1e53fe4639..13febb0a85 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -1731,7 +1731,7 @@ function s:Before_test_dirchanged()
endfunc
function s:After_test_dirchanged()
- exe 'cd' s:dir_this
+ call chdir(s:dir_this)
call delete(s:dir_foo, 'd')
call delete(s:dir_bar, 'd')
augroup test_dirchanged
@@ -1743,11 +1743,11 @@ function Test_dirchanged_global()
call s:Before_test_dirchanged()
autocmd test_dirchanged DirChanged global call add(s:li, "cd:")
autocmd test_dirchanged DirChanged global call add(s:li, expand("<afile>"))
- exe 'cd' s:dir_foo
+ call chdir(s:dir_foo)
call assert_equal(["cd:", s:dir_foo], s:li)
- exe 'cd' s:dir_foo
+ call chdir(s:dir_foo)
call assert_equal(["cd:", s:dir_foo], s:li)
- exe 'lcd' s:dir_bar
+ exe 'lcd ' .. fnameescape(s:dir_bar)
call assert_equal(["cd:", s:dir_foo], s:li)
call s:After_test_dirchanged()
endfunc
@@ -1756,11 +1756,11 @@ function Test_dirchanged_local()
call s:Before_test_dirchanged()
autocmd test_dirchanged DirChanged window call add(s:li, "lcd:")
autocmd test_dirchanged DirChanged window call add(s:li, expand("<afile>"))
- exe 'cd' s:dir_foo
+ call chdir(s:dir_foo)
call assert_equal([], s:li)
- exe 'lcd' s:dir_bar
+ exe 'lcd ' .. fnameescape(s:dir_bar)
call assert_equal(["lcd:", s:dir_bar], s:li)
- exe 'lcd' s:dir_bar
+ exe 'lcd ' .. fnameescape(s:dir_bar)
call assert_equal(["lcd:", s:dir_bar], s:li)
call s:After_test_dirchanged()
endfunc
@@ -1774,7 +1774,7 @@ function Test_dirchanged_auto()
autocmd test_dirchanged DirChanged auto call add(s:li, "auto:")
autocmd test_dirchanged DirChanged auto call add(s:li, expand("<afile>"))
set acd
- exe 'cd ..'
+ cd ..
call assert_equal([], s:li)
exe 'edit ' . s:dir_foo . '/Xfile'
call assert_equal(s:dir_foo, getcwd())