diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-07-19 00:36:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-19 00:36:56 +0200 |
commit | 572ecdfeed16c733ca35601ef2339ab38c530d73 (patch) | |
tree | 31cc9d65005561faeeab1f2c821fd5f9769780bf /src/nvim/testdir/test_source.vim | |
parent | a04e0c8db2d7b9e7abd0dbfbe06f51904f3a32af (diff) | |
parent | fdfdc0a228b896a3ce606fb523f5677092490dcc (diff) | |
download | rneovim-572ecdfeed16c733ca35601ef2339ab38c530d73.tar.gz rneovim-572ecdfeed16c733ca35601ef2339ab38c530d73.tar.bz2 rneovim-572ecdfeed16c733ca35601ef2339ab38c530d73.zip |
Merge #10052 from janlazo/vim-8.1.0729
vim-patch:8.1.{729,732}
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 |