summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_autocmd.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-16 15:38:02 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-16 15:38:02 +0100
commit2caad3fbbdbf1486a176c9f6bfbc3d9be90e09f7 (patch)
treef8c0b685281d64e985fd59046f1c12df66ca85bb /src/testdir/test_autocmd.vim
parent4efe73b478d3ba689078da502fd96f45204ff1f5 (diff)
patch 8.1.0602: DirChanged is also triggered when directory didn't changev8.1.0602
Problem: DirChanged is also triggered when the directory didn't change. (Daniel Hahler) Solution: Compare the current with the new directory. (closes #3697)
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r--src/testdir/test_autocmd.vim33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 3d650e4736..b05b210c20 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -1205,13 +1205,16 @@ function s:Before_test_dirchanged()
augroup END
let s:li = []
let s:dir_this = getcwd()
- let s:dir_other = s:dir_this . '/foo'
- call mkdir(s:dir_other)
+ let s:dir_foo = s:dir_this . '/foo'
+ call mkdir(s:dir_foo)
+ let s:dir_bar = s:dir_this . '/bar'
+ call mkdir(s:dir_bar)
endfunc
function s:After_test_dirchanged()
exe 'cd' s:dir_this
- call delete(s:dir_other, 'd')
+ call delete(s:dir_foo, 'd')
+ call delete(s:dir_bar, 'd')
augroup test_dirchanged
autocmd!
augroup END
@@ -1221,10 +1224,12 @@ 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_other
- call assert_equal(["cd:", s:dir_other], s:li)
- exe 'lcd' s:dir_other
- call assert_equal(["cd:", s:dir_other], s:li)
+ exe 'cd' s:dir_foo
+ call assert_equal(["cd:", s:dir_foo], s:li)
+ exe 'cd' s:dir_foo
+ call assert_equal(["cd:", s:dir_foo], s:li)
+ exe 'lcd' s:dir_bar
+ call assert_equal(["cd:", s:dir_foo], s:li)
call s:After_test_dirchanged()
endfunc
@@ -1232,10 +1237,12 @@ 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_other
+ exe 'cd' s:dir_foo
call assert_equal([], s:li)
- exe 'lcd' s:dir_other
- call assert_equal(["lcd:", s:dir_other], s:li)
+ exe 'lcd' s:dir_bar
+ call assert_equal(["lcd:", s:dir_bar], s:li)
+ exe 'lcd' s:dir_bar
+ call assert_equal(["lcd:", s:dir_bar], s:li)
call s:After_test_dirchanged()
endfunc
@@ -1250,9 +1257,9 @@ function Test_dirchanged_auto()
set acd
exe 'cd ..'
call assert_equal([], s:li)
- exe 'edit ' . s:dir_other . '/Xfile'
- call assert_equal(s:dir_other, getcwd())
- call assert_equal(["auto:", s:dir_other], s:li)
+ exe 'edit ' . s:dir_foo . '/Xfile'
+ call assert_equal(s:dir_foo, getcwd())
+ call assert_equal(["auto:", s:dir_foo], s:li)
set noacd
bwipe!
call s:After_test_dirchanged()