annotate src/testdir/test_ins_complete.vim @ 12686:aa658b33f25a v8.0.1221

patch 8.0.1221: still too many old style tests commit https://github.com/vim/vim/commit/15993ce9210e8b8d4bc11e1d640f6447b18d3e6c Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 26 20:21:44 2017 +0200 patch 8.0.1221: still too many old style tests Problem: Still too many old style tests. Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, closes #2256)
author Christian Brabandt <cb@256bit.org>
date Thu, 26 Oct 2017 20:30:05 +0200
parents
children 03a6aeea2096
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " Test for insert expansion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_ins_complete()
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 set ff=unix
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 call writefile(["test11\t36Gepeto\t/Tag/",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 \ "asd\ttest11file\t36G",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 \ "Makefile\tto\trun"], 'Xtestfile')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call writefile(['', 'start of testfile',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 \ 'ru',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 \ 'run1',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 \ 'run2',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 \ 'STARTTEST',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 \ 'ENDTEST',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 \ 'end of testfile'], 'Xtestdata')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 set ff&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 edit Xtestdata
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 new
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call append(0, ['#include "Xtestfile"', ''])
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call cursor(2, 1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 set cot=
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 set cpt=.,w
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " add-expands (word from next line) from other window
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 exe "normal iru\<C-N>\<C-N>\<C-X>\<C-N>\<Esc>\<C-A>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal('run1 run3', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 " add-expands (current buffer first)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 exe "normal o\<C-P>\<C-X>\<C-N>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal('run3 run3', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " Local expansion, ends in an empty line (unless it becomes a global
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 " expansion)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 exe "normal o\<C-X>\<C-P>\<C-P>\<C-P>\<C-P>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal('', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " starts Local and switches to global add-expansion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 exe "normal o\<C-X>\<C-P>\<C-P>\<C-X>\<C-X>\<C-N>\<C-X>\<C-N>\<C-N>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal('run1 run2', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 set cpt=.,w,i
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " i-add-expands and switches to local
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 exe "normal OM\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-X>\<C-X>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call assert_equal("Makefile\tto\trun3", getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 " add-expands lines (it would end in an empty line if it didn't ignored
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 " itself)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 exe "normal o\<C-X>\<C-L>\<C-X>\<C-L>\<C-P>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal("Makefile\tto\trun3", getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call assert_equal("Makefile\tto\trun3", getline(line('.') - 1))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 set cpt=kXtestfile
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 " checks k-expansion, and file expansion (use Xtest11 instead of test11,
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " because TEST11.OUT may match first on DOS)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 write Xtest11.one
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 write Xtest11.two
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 exe "normal o\<C-N>\<Esc>IX\<Esc>A\<C-X>\<C-F>\<C-N>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 call assert_equal('Xtest11.two', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " use CTRL-X CTRL-F to complete Xtest11.one, remove it and then use CTRL-X
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 " CTRL-F again to verify this doesn't cause trouble.
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 exe "normal oXt\<C-X>\<C-F>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<BS>\<C-X>\<C-F>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call assert_equal('Xtest11.one', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 normal ddk
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 set cpt=w
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " checks make_cyclic in other window
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 exe "normal oST\<C-N>\<C-P>\<C-P>\<C-P>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call assert_equal('STARTTEST', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 set cpt=u nohid
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 " checks unloaded buffer expansion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 only
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 exe "normal oEN\<C-N>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call assert_equal('ENDTEST', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 " checks adding mode abortion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 exe "normal ounl\<C-N>\<C-X>\<C-X>\<C-P>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal('unless', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 set cpt=t,d def=^\\k* tags=Xtestfile notagbsearch
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 " tag expansion, define add-expansion interrupted
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 exe "normal o\<C-X>\<C-]>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-D>\<C-X>\<C-D>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call assert_equal('test11file 36Gepeto /Tag/ asd', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 " t-expansion
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 exe "normal oa\<C-N>\<Esc>"
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal('asd', getline('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 %bw!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call delete('Xtestfile')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call delete('Xtest11.one')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call delete('Xtest11.two')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 call delete('Xtestdata')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 set cpt& cot& def& tags& tagbsearch& hidden&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 endfunc