diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-22 23:44:57 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-07-17 20:23:05 -0400 |
commit | aa681df25fc1b1c22182c8150e53952fefa63e10 (patch) | |
tree | b998bf10d9ba4c08b5e75e69f3e9c85d29794fc3 /src/nvim/testdir/test_source.vim | |
parent | 452ec4ed31d5d9c9ab4af9d8e686182ae11cef0c (diff) | |
download | rneovim-aa681df25fc1b1c22182c8150e53952fefa63e10.tar.gz rneovim-aa681df25fc1b1c22182c8150e53952fefa63e10.tar.bz2 rneovim-aa681df25fc1b1c22182c8150e53952fefa63e10.zip |
vim-patch:8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Problem: There is a SourcePre autocommand event but not a SourcePost.
Solution: Add the SourcePost autocommand event. (closes vim/vim#3739)
https://github.com/vim/vim/commit/2b6185287adf53343ed5f49e967ae402c64063e4
Diffstat (limited to 'src/nvim/testdir/test_source.vim')
-rw-r--r-- | src/nvim/testdir/test_source.vim | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_source.vim b/src/nvim/testdir/test_source.vim index 42ac0c4d0f..697b552df4 100644 --- a/src/nvim/testdir/test_source.vim +++ b/src/nvim/testdir/test_source.vim @@ -8,3 +8,40 @@ func Test_source_sandbox() call assert_fails('sandbox source! Xsourcehello', 'E48:') bwipe! endfunc + +func Test_source_autocmd() + call writefile([ + \ 'let did_source = 1', + \ ], 'Xsourced') + au SourcePre *source* let did_source_pre = 1 + au SourcePost *source* let did_source_post = 1 + + source Xsourced + + call assert_equal(g:did_source, 1) + call assert_equal(g:did_source_pre, 1) + call assert_equal(g:did_source_post, 1) + + call delete('Xsourced') + au! SourcePre + au! SourcePost + unlet g:did_source + unlet g:did_source_pre + unlet g:did_source_post +endfunc + +func Test_source_cmd() + au SourceCmd *source* let did_source = expand('<afile>') + au SourcePre *source* let did_source_pre = 2 + au SourcePost *source* let did_source_post = 2 + + source Xsourced + + call assert_equal(g:did_source, 'Xsourced') + call assert_false(exists('g:did_source_pre')) + call assert_equal(g:did_source_post, 2) + + au! SourceCmd + au! SourcePre + au! SourcePost +endfunc |