aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_autocmd.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_autocmd.vim')
-rw-r--r--src/nvim/testdir/test_autocmd.vim33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index 93083f55c7..c350a17236 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -42,9 +42,7 @@ if has('timers')
endfunc
func Test_cursorhold_insert_with_timer_interrupt()
- if !has('job')
- return
- endif
+ CheckFeature job
" Need to move the cursor.
call feedkeys("ggG", "xt")
@@ -551,9 +549,7 @@ endfunc
func Test_OptionSet()
CheckFunction test_override
- if !has("eval") || !exists("+autochdir")
- return
- endif
+ CheckOption autochdir
call test_override('starting', 1)
set nocp
@@ -1334,14 +1330,14 @@ function s:Before_test_dirchanged()
augroup END
let s:li = []
let s:dir_this = getcwd()
- let s:dir_foo = s:dir_this . '/foo'
+ let s:dir_foo = s:dir_this . '/Xfoo'
call mkdir(s:dir_foo)
- let s:dir_bar = s:dir_this . '/bar'
+ let s:dir_bar = s:dir_this . '/Xbar'
call mkdir(s:dir_bar)
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
@@ -1353,11 +1349,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
@@ -1366,25 +1362,24 @@ 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
function Test_dirchanged_auto()
- if !exists('+autochdir')
- return
- endif
+ CheckFunction test_autochdir
+ CheckOption autochdir
call s:Before_test_dirchanged()
call test_autochdir()
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())