diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-03-11 22:46:20 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-03-12 14:39:32 +0100 |
commit | 99a1a58c66b9bc56d98ee7a8d249d594669e9573 (patch) | |
tree | 6d7b42944639a96d43e7b8ab0db9c37b94af56ac /test | |
parent | 82117da5df93666798b94e4e6e47e11dcb1b4dcd (diff) | |
download | rneovim-99a1a58c66b9bc56d98ee7a8d249d594669e9573.tar.gz rneovim-99a1a58c66b9bc56d98ee7a8d249d594669e9573.tar.bz2 rneovim-99a1a58c66b9bc56d98ee7a8d249d594669e9573.zip |
DirChanged: Publish _after_ updating win/tab CWD.
So getcwd() works correctly during DirChanged event.
Closes #6260
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/autocmd/dirchanged_spec.lua | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/functional/autocmd/dirchanged_spec.lua b/test/functional/autocmd/dirchanged_spec.lua index 15196dbd44..f51a978221 100644 --- a/test/functional/autocmd/dirchanged_spec.lua +++ b/test/functional/autocmd/dirchanged_spec.lua @@ -20,7 +20,9 @@ describe('autocmd DirChanged', function() before_each(function() clear() - command('autocmd DirChanged * let [g:event, g:scope, g:cdcount] = [copy(v:event), expand("<amatch>"), 1 + get(g:, "cdcount", 0)]') + command('autocmd DirChanged * let [g:getcwd_rv, g:event, g:amatch, g:cdcount] ' + ..' = [getcwd(), copy(v:event), expand("<amatch>"), 1 + get(g:, "cdcount", 0)]' + ..[[ | let g:event['cwd'] = substitute(g:event['cwd'], '\\', '/', 'g') ]]) end) it('sets v:event', function() @@ -37,6 +39,17 @@ describe('autocmd DirChanged', function() eq(3, eval('g:cdcount')) end) + it('sets getcwd() during event #6260', function() + command('lcd '..dirs[1]) + eq(dirs[1], eval('g:getcwd_rv')) + + command('tcd '..dirs[2]) + eq(dirs[2], eval('g:getcwd_rv')) + + command('cd '..dirs[3]) + eq(dirs[3], eval('g:getcwd_rv')) + end) + it('disallows recursion', function() command('set shellslash') -- Set up a _nested_ handler. @@ -50,13 +63,13 @@ describe('autocmd DirChanged', function() it('sets <amatch> to CWD "scope"', function() command('lcd '..dirs[1]) - eq('window', eval('g:scope')) + eq('window', eval('g:amatch')) command('tcd '..dirs[2]) - eq('tab', eval('g:scope')) + eq('tab', eval('g:amatch')) command('cd '..dirs[3]) - eq('global', eval('g:scope')) + eq('global', eval('g:amatch')) end) it('does not trigger if :cd fails', function() |