diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-03-12 12:11:10 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-03-12 14:39:32 +0100 |
commit | d9fcbc2cfb5f20f63a2870624ce48a58cf918ea8 (patch) | |
tree | 08987d560a896e3703b82212ac06d28772a497d0 /test | |
parent | 99a1a58c66b9bc56d98ee7a8d249d594669e9573 (diff) | |
download | rneovim-d9fcbc2cfb5f20f63a2870624ce48a58cf918ea8.tar.gz rneovim-d9fcbc2cfb5f20f63a2870624ce48a58cf918ea8.tar.bz2 rneovim-d9fcbc2cfb5f20f63a2870624ce48a58cf918ea8.zip |
DirChanged: trigger when switching scopes
Closes #6054
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/autocmd/dirchanged_spec.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/autocmd/dirchanged_spec.lua b/test/functional/autocmd/dirchanged_spec.lua index f51a978221..7a1f79fd34 100644 --- a/test/functional/autocmd/dirchanged_spec.lua +++ b/test/functional/autocmd/dirchanged_spec.lua @@ -109,6 +109,34 @@ describe('autocmd DirChanged', function() eq({cwd=dirs[2], scope='window'}, eval('g:event')) end) + it("is triggered by switching to win/tab with different CWD #6054", function() + command('lcd '..dirs[3]) -- window 3 + command('split '..dirs[2]..'/foo') -- window 2 + command('lcd '..dirs[2]) + command('split '..dirs[1]..'/bar') -- window 1 + command('lcd '..dirs[1]) + + command('2wincmd w') -- window 2 + eq({cwd=dirs[2], scope='window'}, eval('g:event')) + + eq(4, eval('g:cdcount')) + command('tabnew') -- tab 2 (tab-local CWD) + eq(4, eval('g:cdcount')) -- same CWD, no DirChanged event + command('tcd '..dirs[3]) + command('tabnext') -- tab 1 (no tab-local CWD) + eq({cwd=dirs[2], scope='window'}, eval('g:event')) + command('tabnext') -- tab 2 + eq({cwd=dirs[3], scope='tab'}, eval('g:event')) + eq(7, eval('g:cdcount')) + + command('tabnext') -- tab 1 + command('3wincmd w') -- window 3 + eq(9, eval('g:cdcount')) + command('tabnext') -- tab 2 (has the *same* CWD) + eq(9, eval('g:cdcount')) -- same CWD, no DirChanged event + + end) + it('is triggered by nvim_set_current_dir()', function() request('nvim_set_current_dir', dirs[1]) eq({cwd=dirs[1], scope='global'}, eval('g:event')) |