diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-11 16:30:12 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-11 16:30:12 +0000 |
commit | f6246f51e3d85a982a899b4a8fd9045a5e23016f (patch) | |
tree | 9c4d6c203fb5aa0703bf5055d612e27b82d35cef /src/testdir/test_autocmd.vim | |
parent | 14f23122bf94d0d835bed6f0bd0d17b3e47441ab (diff) |
patch 8.2.4345: <amatch> is expanded like a file name for DirChangedPrev8.2.4345
Problem: <amatch> is expanded like a file name for DirChangedPre.
Solution: Do not expand <amatch>. (closes #9742) Also for the User event.
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r-- | src/testdir/test_autocmd.vim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 3ff4c3cf5b..d3c9b89024 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -1899,6 +1899,14 @@ func Test_autocommand_all_events() call assert_fails('au! * x bwipe', 'E1155:') endfunc +func Test_autocmd_user() + au User MyEvent let s:res = [expand("<afile>"), expand("<amatch>")] + doautocmd User MyEvent + call assert_equal(['MyEvent', 'MyEvent'], s:res) + au! User + unlet s:res +endfunc + function s:Before_test_dirchanged() augroup test_dirchanged autocmd! @@ -1922,11 +1930,11 @@ endfunc function Test_dirchanged_global() call s:Before_test_dirchanged() - autocmd test_dirchanged DirChangedPre global call add(s:li, "pre cd " .. v:event.directory) + autocmd test_dirchanged DirChangedPre global call add(s:li, expand("<amatch>") .. " pre cd " .. v:event.directory) autocmd test_dirchanged DirChanged global call add(s:li, "cd:") autocmd test_dirchanged DirChanged global call add(s:li, expand("<afile>")) call chdir(s:dir_foo) - let expected = ["pre cd " .. s:dir_foo, "cd:", s:dir_foo] + let expected = ["global pre cd " .. s:dir_foo, "cd:", s:dir_foo] call assert_equal(expected, s:li) call chdir(s:dir_foo) call assert_equal(expected, s:li) |