annotate src/testdir/test_source.vim @ 15442:3e2e1608efa4 v8.1.0729

patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost commit https://github.com/vim/vim/commit/2b6185287adf53343ed5f49e967ae402c64063e4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 12 13:26:03 2019 +0100 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 https://github.com/vim/vim/issues/3739)
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Jan 2019 13:30:07 +0100
parents
children fbab59a5ee6b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15442
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for the :source command.
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 func Test_source_autocmd()
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 call writefile([
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 \ 'let did_source = 1',
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 \ ], 'Xsourced')
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 au SourcePre *source* let did_source_pre = 1
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 au SourcePost *source* let did_source_post = 1
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 source Xsourced
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 call assert_equal(g:did_source, 1)
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 call assert_equal(g:did_source_pre, 1)
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 call assert_equal(g:did_source_post, 1)
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 call delete('Xsourced')
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 au! SourcePre
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 au! SourcePost
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 unlet g:did_source
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 unlet g:did_source_pre
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 unlet g:did_source_post
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 endfunc
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 func Test_source_cmd()
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 au SourceCmd *source* let did_source = expand('<afile>')
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 au SourcePre *source* let did_source_pre = 2
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 au SourcePost *source* let did_source_post = 2
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 source Xsourced
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call assert_equal(g:did_source, 'Xsourced')
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 call assert_false(exists('g:did_source_pre'))
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 call assert_equal(g:did_source_post, 2)
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 au! SourceCmd
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 au! SourcePre
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 au! SourcePost
3e2e1608efa4 patch 8.1.0729: there is a SourcePre autocommand event but not a SourcePost
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 endfunc