From 6004f9137a5625025cfa76700239d9abcac85f47 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 17 Oct 2021 22:04:53 +0800 Subject: refactor(dirchanged): tab -> tabpage Match Vim's behavior. --- test/functional/autocmd/dirchanged_spec.lua | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/functional/autocmd/dirchanged_spec.lua b/test/functional/autocmd/dirchanged_spec.lua index ce3b2e8d3e..bbbc98e5a2 100644 --- a/test/functional/autocmd/dirchanged_spec.lua +++ b/test/functional/autocmd/dirchanged_spec.lua @@ -33,17 +33,20 @@ describe('autocmd DirChanged', function() command([[autocmd DirChanged * let g:getcwd = substitute(g:getcwd, '\\', '/', 'g')]]) end) - it('sets v:event', function() + it('sets v:event and ', function() command('lcd '..dirs[1]) eq({cwd=dirs[1], scope='window', changed_window=false}, eval('g:ev')) + eq('window', eval('g:amatch')) eq(1, eval('g:cdcount')) command('tcd '..dirs[2]) - eq({cwd=dirs[2], scope='tab', changed_window=false}, eval('g:ev')) + eq({cwd=dirs[2], scope='tabpage', changed_window=false}, eval('g:ev')) + eq('tabpage', eval('g:amatch')) eq(2, eval('g:cdcount')) command('cd '..dirs[3]) eq({cwd=dirs[3], scope='global', changed_window=false}, eval('g:ev')) + eq('global', eval('g:amatch')) eq(3, eval('g:cdcount')) end) @@ -69,17 +72,6 @@ describe('autocmd DirChanged', function() eq(dirs[3], eval('getcwd()')) end) - it('sets to CWD "scope"', function() - command('lcd '..dirs[1]) - eq('window', eval('g:amatch')) - - command('tcd '..dirs[2]) - eq('tab', eval('g:amatch')) - - command('cd '..dirs[3]) - eq('global', eval('g:amatch')) - end) - it('does not trigger if :cd fails', function() command('let g:ev = {}') @@ -135,7 +127,8 @@ describe('autocmd DirChanged', function() end command('tcd '..dirs[2]) - eq({cwd=dirs[2], scope='tab', changed_window=false}, eval('g:ev')) + eq({cwd=dirs[2], scope='tabpage', changed_window=false}, eval('g:ev')) + eq('tabpage', eval('g:amatch')) eq(2, eval('g:cdcount')) command('let g:ev = {}') command('tcd '..dirs[2]) @@ -195,8 +188,10 @@ describe('autocmd DirChanged', function() command('tcd '..dirs[3]) command('tabnext') -- tab 1 (no tab-local CWD) eq({cwd=dirs[2], scope='window', changed_window=true}, eval('g:ev')) + eq('window', eval('g:amatch')) command('tabnext') -- tab 2 - eq({cwd=dirs[3], scope='tab', changed_window=true}, eval('g:ev')) + eq({cwd=dirs[3], scope='tabpage', changed_window=true}, eval('g:ev')) + eq('tabpage', eval('g:amatch')) eq(7, eval('g:cdcount')) command('tabnext') -- tab 1 -- cgit