annotate src/testdir/test_tagjump.vim @ 20409:fd1b6f4f497e v8.2.0759

patch 8.2.0759: Vim9: missing changes for performance improvements Commit: https://github.com/vim/vim/commit/270d0388d284c130b322b185497e437cfbbae412 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 15 21:42:53 2020 +0200 patch 8.2.0759: Vim9: missing changes for performance improvements Problem: Vim9: missing changes for performance improvements Solution: Use GA_GROW(). Don't call breakcheck so often.
author Bram Moolenaar <Bram@vim.org>
date Fri, 15 May 2020 21:45:03 +0200
parents 16460964c304
children 8b775cd23555
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8934
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for tagjump (tags and special searches)
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
3 source check.vim
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
4 source screendump.vim
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
5
8934
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " SEGV occurs in older versions. (At least 7.4.1748 or older)
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_ptag_with_notagstack()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
8 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
9
8934
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 set notagstack
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_fails('ptag does_not_exist_tag_name', 'E426')
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 set tagstack&vim
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endfunc
9228
ea504064c996 commit https://github.com/vim/vim/commit/fd89d7ea81b18d32363456b16258174dc9e095dc
Christian Brabandt <cb@256bit.org>
parents: 8934
diff changeset
14
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
15 func Test_cancel_ptjump()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
16 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
17
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
18 set tags=Xtags
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
19 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
20 \ "word\tfile1\tcmd1",
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
21 \ "word\tfile2\tcmd2"],
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
22 \ 'Xtags')
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
23
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
24 only!
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
25 call feedkeys(":ptjump word\<CR>\<CR>", "xt")
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
26 help
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
27 call assert_equal(2, winnr('$'))
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
28
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
29 call delete('Xtags')
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
30 set tags&
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
31 quit
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
32 endfunc
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
33
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
34 func Test_static_tagjump()
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
35 set tags=Xtags
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
36 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
37 \ "one\tXfile1\t/^one/;\"\tf\tfile:\tsignature:(void)",
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
38 \ "word\tXfile2\tcmd2"],
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
39 \ 'Xtags')
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
40 new Xfile1
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
41 call setline(1, ['empty', 'one()', 'empty'])
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
42 write
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
43 tag one
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
44 call assert_equal(2, line('.'))
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
45
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
46 bwipe!
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
47 set tags&
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
48 call delete('Xtags')
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
49 call delete('Xfile1')
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
50 endfunc
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
51
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
52 func Test_duplicate_tagjump()
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
53 set tags=Xtags
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
54 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
55 \ "thesame\tXfile1\t1;\"\td\tfile:",
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
56 \ "thesame\tXfile1\t2;\"\td\tfile:",
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
57 \ "thesame\tXfile1\t3;\"\td\tfile:",
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
58 \ ],
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
59 \ 'Xtags')
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
60 new Xfile1
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
61 call setline(1, ['thesame one', 'thesame two', 'thesame three'])
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
62 write
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
63 tag thesame
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
64 call assert_equal(1, line('.'))
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
65 tnext
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
66 call assert_equal(2, line('.'))
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
67 tnext
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
68 call assert_equal(3, line('.'))
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
69
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
70 bwipe!
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
71 set tags&
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
72 call delete('Xtags')
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
73 call delete('Xfile1')
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
74 endfunc
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
75
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
76 func Test_tagjump_switchbuf()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
77 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
78
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
79 set tags=Xtags
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
80 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
81 \ "second\tXfile1\t2",
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
82 \ "third\tXfile1\t3",],
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
83 \ 'Xtags')
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
84 call writefile(['first', 'second', 'third'], 'Xfile1')
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
85
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
86 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
87 set switchbuf=
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
88 stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
89 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
90 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
91 stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
92 call assert_equal(3, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
93 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
94
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
95 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
96 set switchbuf=useopen
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
97 stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
98 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
99 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
100 stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
101 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
102 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
103
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
104 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
105 set switchbuf=usetab
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
106 tab stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
107 call assert_equal(2, tabpagenr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
108 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
109 1tabnext | stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
110 call assert_equal(2, tabpagenr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
111 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
112
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
113 tabclose!
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
114 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
115 call delete('Xfile1')
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
116 call delete('Xtags')
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
117 set tags&
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
118 set switchbuf&vim
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
119 endfunc
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
120
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
121 " Tests for [ CTRL-I and CTRL-W CTRL-I commands
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
122 function Test_keyword_jump()
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
123 call writefile(["#include Xinclude", "",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
124 \ "",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
125 \ "/* test text test tex start here",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
126 \ " some text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
127 \ " test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
128 \ " start OK if found this line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
129 \ " start found wrong line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
130 \ "test text"], 'Xtestfile')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
131 call writefile(["/* test text test tex start here",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
132 \ " some text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
133 \ " test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
134 \ " start OK if found this line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
135 \ " start found wrong line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
136 \ "test text"], 'Xinclude')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
137 new Xtestfile
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
138 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
139 call search("start")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
140 exe "normal! 5[\<C-I>"
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
141 call assert_equal(" start OK if found this line", getline('.'))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
142 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
143 call search("start")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
144 exe "normal! 5\<C-W>\<C-I>"
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
145 call assert_equal(" start OK if found this line", getline('.'))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
146 enew! | only
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
147 call delete('Xtestfile')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
148 call delete('Xinclude')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
149 endfunction
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
150
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
151 " Test for jumping to a tag with 'hidden' set, with symbolic link in path of
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
152 " tag. This only works for Unix, because of the symbolic link.
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
153 func Test_tag_symbolic()
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
154 if !has('unix')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
155 return
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
156 endif
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
157 set hidden
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
158 call delete("Xtest.dir", "rf")
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
159 call system("ln -s . Xtest.dir")
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
160 " Create a tags file with the current directory name inserted.
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
161 call writefile([
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
162 \ "SECTION_OFF " . getcwd() . "/Xtest.dir/Xtest.c /^#define SECTION_OFF 3$/",
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
163 \ '',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
164 \ ], 'Xtags')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
165 call writefile(['#define SECTION_OFF 3',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
166 \ '#define NUM_SECTIONS 3'], 'Xtest.c')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
167
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
168 " Try jumping to a tag, but with a path that contains a symbolic link. When
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
169 " wrong, this will give the ATTENTION message. The next space will then be
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
170 " eaten by hit-return, instead of moving the cursor to 'd'.
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
171 set tags=Xtags
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
172 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
173 call append(0, 'SECTION_OFF')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
174 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
175 exe "normal \<C-]> "
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
176 call assert_equal('Xtest.c', expand('%:t'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
177 call assert_equal(2, col('.'))
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
178
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
179 set hidden&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
180 set tags&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
181 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
182 call delete('Xtags')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
183 call delete('Xtest.c')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
184 call delete("Xtest.dir", "rf")
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
185 %bwipe!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
186 endfunc
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
187
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
188 " Tests for tag search with !_TAG_FILE_ENCODING.
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
189 " Depends on the test83-tags2 and test83-tags3 files.
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
190 func Test_tag_file_encoding()
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
191 if has('vms')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
192 return
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
193 endif
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
194
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
195 if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21"
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
196 return
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
197 endif
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
198
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
199 let save_enc = &encoding
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
200 set encoding=utf8
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
201
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
202 let content = ['text for tags1', 'abcdefghijklmnopqrs']
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
203 call writefile(content, 'Xtags1.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
204 let content = ['text for tags2', 'ABC']
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
205 call writefile(content, 'Xtags2.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
206 let content = ['text for tags3', 'ABC']
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
207 call writefile(content, 'Xtags3.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
208 let content = ['!_TAG_FILE_ENCODING utf-8 //', 'abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs']
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
209 call writefile(content, 'Xtags1')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
210
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
211 " case1:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
212 new
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
213 set tags=Xtags1
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
214 tag abcdefghijklmnopqrs
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
215 call assert_equal('Xtags1.txt', expand('%:t'))
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
216 call assert_equal('abcdefghijklmnopqrs', getline('.'))
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
217 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
218
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
219 " case2:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
220 new
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
221 set tags=test83-tags2
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
222 tag /.BC
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
223 call assert_equal('Xtags2.txt', expand('%:t'))
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
224 call assert_equal('ABC', getline('.'))
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
225 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
226
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
227 " case3:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
228 new
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
229 set tags=test83-tags3
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
230 tag abc50
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
231 call assert_equal('Xtags3.txt', expand('%:t'))
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
232 call assert_equal('ABC', getline('.'))
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
233 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
234
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
235 set tags&
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
236 let &encoding = save_enc
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
237 call delete('Xtags1.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
238 call delete('Xtags2.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
239 call delete('Xtags3.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
240 call delete('Xtags1')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
241 endfunc
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
242
13227
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
243 func Test_tagjump_etags()
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
244 if !has('emacs_tags')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
245 return
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
246 endif
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
247 call writefile([
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
248 \ "void foo() {}",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
249 \ "int main(int argc, char **argv)",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
250 \ "{",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
251 \ "\tfoo();",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
252 \ "\treturn 0;",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
253 \ "}",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
254 \ ], 'Xmain.c')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
255
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
256 call writefile([
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
257 \ "\x0c",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
258 \ "Xmain.c,64",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
259 \ "void foo() {}\x7ffoo\x011,0",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
260 \ "int main(int argc, char **argv)\x7fmain\x012,14",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
261 \ ], 'Xtags')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
262 set tags=Xtags
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
263 ta foo
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
264 call assert_equal('void foo() {}', getline('.'))
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
265
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
266 call delete('Xtags')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
267 call delete('Xmain.c')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
268 bwipe!
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
269 endfunc
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
270
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
271 " Test for getting and modifying the tag stack
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
272 func Test_getsettagstack()
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
273 call writefile(['line1', 'line2', 'line3'], 'Xfile1')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
274 call writefile(['line1', 'line2', 'line3'], 'Xfile2')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
275 call writefile(['line1', 'line2', 'line3'], 'Xfile3')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
276
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
277 enew | only
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
278 call settagstack(1, {'items' : []})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
279 call assert_equal(0, gettagstack(1).length)
17912
9fac6d0de69a patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17093
diff changeset
280 call assert_equal([], 1->gettagstack().items)
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
281 " Error cases
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
282 call assert_equal({}, gettagstack(100))
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
283 call assert_equal(-1, settagstack(100, {'items' : []}))
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
284 call assert_fails('call settagstack(1, [1, 10])', 'E715')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
285 call assert_fails("call settagstack(1, {'items' : 10})", 'E714')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
286 call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
287 call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962')
20120
16460964c304 patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
288 call assert_equal(-1, settagstack(0, test_null_dict()))
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
289
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
290 set tags=Xtags
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
291 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
292 \ "one\tXfile1\t1",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
293 \ "three\tXfile3\t3",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
294 \ "two\tXfile2\t2"],
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
295 \ 'Xtags')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
296
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
297 let stk = []
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
298 call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'one',
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
299 \ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
300 tag one
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
301 call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'two',
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
302 \ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
303 tag two
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
304 call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'three',
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
305 \ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
306 tag three
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
307 call assert_equal(3, gettagstack(1).length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
308 call assert_equal(stk, gettagstack(1).items)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
309 " Check for default - current window
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
310 call assert_equal(3, gettagstack().length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
311 call assert_equal(stk, gettagstack().items)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
312
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
313 " Try to set current index to invalid values
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
314 call settagstack(1, {'curidx' : -1})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
315 call assert_equal(1, gettagstack().curidx)
18000
7a19c8d6bb9e patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17912
diff changeset
316 eval {'curidx' : 50}->settagstack(1)
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
317 call assert_equal(4, gettagstack().curidx)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
318
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
319 " Try pushing invalid items onto the stack
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
320 call settagstack(1, {'items' : []})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
321 call settagstack(1, {'items' : ["plate"]}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
322 call assert_equal(0, gettagstack().length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
323 call assert_equal([], gettagstack().items)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
324 call settagstack(1, {'items' : [{"tagname" : "abc"}]}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
325 call assert_equal(0, gettagstack().length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
326 call assert_equal([], gettagstack().items)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
327 call settagstack(1, {'items' : [{"from" : 100}]}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
328 call assert_equal(0, gettagstack().length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
329 call assert_equal([], gettagstack().items)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
330 call settagstack(1, {'items' : [{"from" : [2, 1, 0, 0]}]}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
331 call assert_equal(0, gettagstack().length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
332 call assert_equal([], gettagstack().items)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
333
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
334 " Push one item at a time to the stack
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
335 call settagstack(1, {'items' : []})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
336 call settagstack(1, {'items' : [stk[0]]}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
337 call settagstack(1, {'items' : [stk[1]]}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
338 call settagstack(1, {'items' : [stk[2]]}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
339 call settagstack(1, {'curidx' : 4})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
340 call assert_equal({'length' : 3, 'curidx' : 4, 'items' : stk},
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
341 \ gettagstack(1))
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
342
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
343 " Try pushing items onto a full stack
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
344 for i in range(7)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
345 call settagstack(1, {'items' : stk}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
346 endfor
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
347 call assert_equal(20, gettagstack().length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
348 call settagstack(1,
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
349 \ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 'a')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
350 call assert_equal('abc', gettagstack().items[19].tagname)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
351
19033
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
352 " truncate the tag stack
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
353 call settagstack(1,
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
354 \ {'curidx' : 9,
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
355 \ 'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
356 let t = gettagstack()
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
357 call assert_equal(9, t.length)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
358 call assert_equal(10, t.curidx)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
359
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
360 " truncate the tag stack without pushing any new items
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
361 call settagstack(1, {'curidx' : 5}, 't')
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
362 let t = gettagstack()
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
363 call assert_equal(4, t.length)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
364 call assert_equal(5, t.curidx)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
365
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
366 " truncate an empty tag stack and push new items
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
367 call settagstack(1, {'items' : []})
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
368 call settagstack(1,
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
369 \ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
370 let t = gettagstack()
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
371 call assert_equal(1, t.length)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
372 call assert_equal(2, t.curidx)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
373
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
374 " Tag with multiple matches
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
375 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
376 \ "two\tXfile1\t1",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
377 \ "two\tXfile2\t3",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
378 \ "two\tXfile3\t2"],
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
379 \ 'Xtags')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
380 call settagstack(1, {'items' : []})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
381 tag two
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
382 tnext
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
383 tnext
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
384 call assert_equal(1, gettagstack().length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
385 call assert_equal(3, gettagstack().items[0].matchnr)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
386
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
387 " Memory allocation failures
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
388 call test_alloc_fail(GetAllocId('tagstack_items'), 0, 0)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
389 call assert_fails('call gettagstack()', 'E342:')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
390 call test_alloc_fail(GetAllocId('tagstack_from'), 0, 0)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
391 call assert_fails('call gettagstack()', 'E342:')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
392 call test_alloc_fail(GetAllocId('tagstack_details'), 0, 0)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
393 call assert_fails('call gettagstack()', 'E342:')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
394
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
395 call settagstack(1, {'items' : []})
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
396 call delete('Xfile1')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
397 call delete('Xfile2')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
398 call delete('Xfile3')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
399 call delete('Xtags')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
400 set tags&
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
401 endfunc
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
402
16164
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
403 func Test_tag_with_count()
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
404 call writefile([
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
405 \ 'test Xtest.h /^void test();$/;" p typeref:typename:void signature:()',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
406 \ ], 'Xtags')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
407 call writefile([
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
408 \ 'main Xtest.c /^int main()$/;" f typeref:typename:int signature:()',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
409 \ 'test Xtest.c /^void test()$/;" f typeref:typename:void signature:()',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
410 \ ], 'Ytags')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
411 cal writefile([
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
412 \ 'int main()',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
413 \ 'void test()',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
414 \ ], 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
415 cal writefile([
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
416 \ 'void test();',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
417 \ ], 'Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
418 set tags=Xtags,Ytags
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
419
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
420 new Xtest.c
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
421 let tl = taglist('test', 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
422 call assert_equal(tl[0].filename, 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
423 call assert_equal(tl[1].filename, 'Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
424
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
425 tag test
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
426 call assert_equal(bufname('%'), 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
427 1tag test
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
428 call assert_equal(bufname('%'), 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
429 2tag test
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
430 call assert_equal(bufname('%'), 'Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
431
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
432 set tags&
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
433 call delete('Xtags')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
434 call delete('Ytags')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
435 bwipe Xtest.h
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
436 bwipe Xtest.c
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
437 call delete('Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
438 call delete('Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
439 endfunc
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
440
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
441 func Test_tagnr_recall()
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
442 call writefile([
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
443 \ 'test Xtest.h /^void test();$/;" p',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
444 \ 'main Xtest.c /^int main()$/;" f',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
445 \ 'test Xtest.c /^void test()$/;" f',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
446 \ ], 'Xtags')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
447 cal writefile([
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
448 \ 'int main()',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
449 \ 'void test()',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
450 \ ], 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
451 cal writefile([
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
452 \ 'void test();',
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
453 \ ], 'Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
454 set tags=Xtags
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
455
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
456 new Xtest.c
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
457 let tl = taglist('test', 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
458 call assert_equal(tl[0].filename, 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
459 call assert_equal(tl[1].filename, 'Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
460
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
461 2tag test
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
462 call assert_equal(bufname('%'), 'Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
463 pop
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
464 call assert_equal(bufname('%'), 'Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
465 tag
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
466 call assert_equal(bufname('%'), 'Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
467
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
468 set tags&
16164
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
469 call delete('Xtags')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
470 bwipe Xtest.h
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
471 bwipe Xtest.c
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
472 call delete('Xtest.h')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
473 call delete('Xtest.c')
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
474 endfunc
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
475
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
476 func Test_tag_line_toolong()
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
477 call writefile([
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
478 \ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
479 \ ], 'Xtags')
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
480 set tags=Xtags
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
481 let old_vbs = &verbose
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
482 set verbose=5
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
483 " ":tjump" should give "tag not found" not "Format error in tags file"
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
484 call assert_fails('tj /foo', 'E426')
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
485 try
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
486 tj /foo
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
487 catch /^Vim\%((\a\+)\)\=:E431/
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
488 call assert_report(v:exception)
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
489 catch /.*/
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
490 endtry
18550
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
491 call assert_equal('Searching tags file Xtags', split(execute('messages'), '\n')[-1])
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
492
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
493 call writefile([
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
494 \ '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
495 \ ], 'Xtags')
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
496 call assert_fails('tj /foo', 'E426')
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
497 try
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
498 tj /foo
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
499 catch /^Vim\%((\a\+)\)\=:E431/
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
500 call assert_report(v:exception)
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
501 catch /.*/
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
502 endtry
18550
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
503 call assert_equal('Searching tags file Xtags', split(execute('messages'), '\n')[-1])
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
504
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
505 " binary search works in file with long line
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
506 call writefile([
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
507 \ 'asdfasfd nowhere 16',
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
508 \ 'foobar Xsomewhere 3; " 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567',
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
509 \ 'zasdfasfd nowhere 16',
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
510 \ ], 'Xtags')
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
511 call writefile([
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
512 \ 'one',
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
513 \ 'two',
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
514 \ 'trhee',
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
515 \ 'four',
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
516 \ ], 'Xsomewhere')
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
517 tag foobar
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
518 call assert_equal('Xsomewhere', expand('%'))
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
519 call assert_equal(3, getcurpos()[1])
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
520
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
521 call delete('Xtags')
18550
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
522 call delete('Xsomewhere')
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
523 set tags&
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
524 let &verbose = old_vbs
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
525 endfunc
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
526
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
527 " Check that using :tselect does not run into the hit-enter prompt.
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
528 " Requires a terminal to trigger that prompt.
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
529 func Test_tselect()
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
530 CheckScreendump
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
531
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
532 call writefile([
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
533 \ 'main Xtest.h /^void test();$/;" f',
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
534 \ 'main Xtest.c /^int main()$/;" f',
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
535 \ 'main Xtest.x /^void test()$/;" f',
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
536 \ ], 'Xtags')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
537 cal writefile([
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
538 \ 'int main()',
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
539 \ 'void test()',
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
540 \ ], 'Xtest.c')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
541
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
542 let lines =<< trim [SCRIPT]
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
543 set tags=Xtags
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
544 [SCRIPT]
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
545 call writefile(lines, 'XTest_tselect')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
546 let buf = RunVimInTerminal('-S XTest_tselect', {'rows': 10, 'cols': 50})
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
547
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
548 call TermWait(buf, 50)
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
549 call term_sendkeys(buf, ":tselect main\<CR>2\<CR>")
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
550 call VerifyScreenDump(buf, 'Test_tselect_1', {})
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
551
18297
b0b37bd807ba patch 8.1.2143: cannot see each command even when 'verbose' is set
Bram Moolenaar <Bram@vim.org>
parents: 18293
diff changeset
552 call StopVimInTerminal(buf)
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
553 call delete('Xtags')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
554 call delete('Xtest.c')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
555 call delete('XTest_tselect')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
556 endfunc
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
557
18640
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
558 func Test_tagline()
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
559 call writefile([
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
560 \ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:1 language:Python class:Foo',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
561 \ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:3 language:Python class:Bar',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
562 \], 'Xtags')
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
563 call writefile([
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
564 \ ' def provision(self, **kwargs):',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
565 \ ' pass',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
566 \ ' def provision(self, **kwargs):',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
567 \ ' pass',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
568 \], 'Xtest.py')
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
569
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
570 set tags=Xtags
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
571
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
572 1tag provision
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
573 call assert_equal(line('.'), 1)
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
574 2tag provision
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
575 call assert_equal(line('.'), 3)
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
576
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
577 call delete('Xtags')
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
578 call delete('Xtest.py')
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
579 set tags&
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
580 endfunc
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
581
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
582 " Test for expanding environment variable in a tag file name
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
583 func Test_tag_envvar()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
584 call writefile(["Func1\t$FOO\t/^Func1/"], 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
585 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
586
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
587 let $FOO='TagTestEnv'
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
588
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
589 let caught_exception = v:false
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
590 try
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
591 tag Func1
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
592 catch /E429:/
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
593 call assert_match('E429:.*"TagTestEnv".*', v:exception)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
594 let caught_exception = v:true
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
595 endtry
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
596 call assert_true(caught_exception)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
597
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
598 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
599 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
600 unlet $FOO
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
601 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
602
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
603 " Test for :ptag
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
604 func Test_tag_preview()
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
605 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
606 \ "second\tXfile1\t2",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
607 \ "third\tXfile1\t3",],
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
608 \ 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
609 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
610 call writefile(['first', 'second', 'third'], 'Xfile1')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
611
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
612 enew | only
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
613 ptag third
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
614 call assert_equal(2, winnr())
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
615 call assert_equal(2, winnr('$'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
616 call assert_equal(1, getwinvar(1, '&previewwindow'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
617 call assert_equal(0, getwinvar(2, '&previewwindow'))
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
618 wincmd P
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
619 call assert_equal(3, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
620
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
621 " jump to the tag again
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
622 wincmd w
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
623 ptag third
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
624 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
625 call assert_equal(3, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
626
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
627 " jump to the newer tag
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
628 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
629 ptag
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
630 wincmd P
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
631 call assert_equal(3, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
632
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
633 " close the preview window
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
634 pclose
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
635 call assert_equal(1, winnr('$'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
636
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
637 call delete('Xfile1')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
638 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
639 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
640 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
641
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
642 " Tests for guessing the tag location
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
643 func Test_tag_guess()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
644 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
645 \ "func1\tXfoo\t/^int func1(int x)/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
646 \ "func2\tXfoo\t/^int func2(int y)/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
647 \ "func3\tXfoo\t/^func3/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
648 \ "func4\tXfoo\t/^func4/"],
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
649 \ 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
650 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
651 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
652
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
653 int FUNC1 (int x) { }
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
654 int
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
655 func2 (int y) { }
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
656 int * func3 () { }
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
657
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
658 [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
659 call writefile(code, 'Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
660
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
661 let v:statusmsg = ''
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
662 ta func1
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
663 call assert_match('E435:', v:statusmsg)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
664 call assert_equal(2, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
665 let v:statusmsg = ''
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
666 ta func2
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
667 call assert_match('E435:', v:statusmsg)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
668 call assert_equal(4, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
669 let v:statusmsg = ''
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
670 ta func3
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
671 call assert_match('E435:', v:statusmsg)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
672 call assert_equal(5, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
673 call assert_fails('ta func4', 'E434:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
674
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
675 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
676 call delete('Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
677 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
678 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
679
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
680 " Test for an unsorted tags file
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
681 func Test_tag_sort()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
682 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
683 \ "first\tXfoo\t1",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
684 \ "ten\tXfoo\t3",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
685 \ "six\tXfoo\t2"],
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
686 \ 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
687 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
688 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
689 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
690 int six() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
691 int ten() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
692 [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
693 call writefile(code, 'Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
694
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
695 call assert_fails('tag first', 'E432:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
696
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
697 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
698 call delete('Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
699 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
700 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
701 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
702
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
703 " Test for an unsorted tags file
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
704 func Test_tag_fold()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
705 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
706 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
707 \ "!_TAG_FILE_SORTED\t2\t/0=unsorted, 1=sorted, 2=foldcase/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
708 \ "first\tXfoo\t1",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
709 \ "second\tXfoo\t2",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
710 \ "third\tXfoo\t3"],
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
711 \ 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
712 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
713 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
714 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
715 int second() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
716 int third() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
717 [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
718 call writefile(code, 'Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
719
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
720 enew
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
721 tag second
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
722 call assert_equal('Xfoo', bufname(''))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
723 call assert_equal(2, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
724
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
725 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
726 call delete('Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
727 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
728 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
729 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
730
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
731 " Test for the :ltag command
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
732 func Test_ltag()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
733 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
734 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
735 \ "first\tXfoo\t1",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
736 \ "second\tXfoo\t/^int second() {}$/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
737 \ "third\tXfoo\t3"],
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
738 \ 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
739 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
740 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
741 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
742 int second() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
743 int third() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
744 [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
745 call writefile(code, 'Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
746
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
747 enew
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
748 call setloclist(0, [], 'f')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
749 ltag third
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
750 call assert_equal('Xfoo', bufname(''))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
751 call assert_equal(3, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
752 call assert_equal([{'lnum': 3, 'bufnr': bufnr('Xfoo'), 'col': 0,
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
753 \ 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '',
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
754 \ 'module': '', 'text': 'third'}], getloclist(0))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
755
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
756 ltag second
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
757 call assert_equal(2, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
758 call assert_equal([{'lnum': 0, 'bufnr': bufnr('Xfoo'), 'col': 0,
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
759 \ 'pattern': '^\Vint second() {}\$', 'valid': 1, 'vcol': 0, 'nr': 0,
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
760 \ 'type': '', 'module': '', 'text': 'second'}], getloclist(0))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
761
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
762 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
763 call delete('Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
764 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
765 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
766 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
767
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
768 " Test for setting the last search pattern to the tag search pattern
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
769 " when cpoptions has 't'
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
770 func Test_tag_last_search_pat()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
771 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
772 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
773 \ "first\tXfoo\t/^int first() {}/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
774 \ "second\tXfoo\t/^int second() {}/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
775 \ "third\tXfoo\t/^int third() {}/"],
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
776 \ 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
777 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
778 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
779 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
780 int second() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
781 int third() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
782 [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
783 call writefile(code, 'Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
784
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
785 enew
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
786 let save_cpo = &cpo
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
787 set cpo+=t
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
788 let @/ = ''
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
789 tag second
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
790 call assert_equal('^int second() {}', @/)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
791 let &cpo = save_cpo
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
792
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
793 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
794 call delete('Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
795 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
796 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
797 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
798
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
799 " Tag stack tests
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
800 func Test_tag_stack()
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
801 let l = []
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
802 for i in range(10, 31)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
803 let l += ["var" .. i .. "\tXfoo\t/^int var" .. i .. ";$/"]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
804 endfor
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
805 call writefile(l, 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
806 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
807
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
808 let l = []
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
809 for i in range(10, 31)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
810 let l += ["int var" .. i .. ";"]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
811 endfor
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
812 call writefile(l, 'Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
813
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
814 " Jump to a tag when the tag stack is full. Oldest entry should be removed.
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
815 enew
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
816 for i in range(10, 30)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
817 exe "tag var" .. i
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
818 endfor
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
819 let l = gettagstack()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
820 call assert_equal(20, l.length)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
821 call assert_equal('var11', l.items[0].tagname)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
822 tag var31
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
823 let l = gettagstack()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
824 call assert_equal('var12', l.items[0].tagname)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
825 call assert_equal('var31', l.items[19].tagname)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
826
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
827 " Use tnext with a single match
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
828 call assert_fails('tnext', 'E427:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
829
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
830 " Jump to newest entry from the top of the stack
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
831 call assert_fails('tag', 'E556:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
832
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
833 " Pop with zero count from the top of the stack
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
834 call assert_fails('0pop', 'E556:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
835
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
836 " Pop from an unsaved buffer
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
837 enew!
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
838 call append(1, "sample text")
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
839 call assert_fails('pop', 'E37:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
840 call assert_equal(21, gettagstack().curidx)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
841 enew!
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
842
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
843 " Pop all the entries in the tag stack
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
844 call assert_fails('30pop', 'E555:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
845
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
846 " Pop with a count when already at the bottom of the stack
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
847 call assert_fails('exe "normal 4\<C-T>"', 'E555:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
848 call assert_equal(1, gettagstack().curidx)
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
849
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
850 " Jump to newest entry from the bottom of the stack with zero count
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
851 call assert_fails('0tag', 'E555:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
852
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
853 " Pop the tag stack when it is empty
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
854 call settagstack(1, {'items' : []})
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
855 call assert_fails('pop', 'E73:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
856
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
857 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
858 call delete('Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
859 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
860 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
861 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
862
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
863 " Test for browsing multiple matching tags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
864 func Test_tag_multimatch()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
865 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
866 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
867 \ "first\tXfoo\t1",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
868 \ "first\tXfoo\t2",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
869 \ "first\tXfoo\t3"],
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
870 \ 'Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
871 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
872 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
873 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
874 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
875 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
876 [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
877 call writefile(code, 'Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
878
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
879 call settagstack(1, {'items' : []})
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
880 tag first
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
881 tlast
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
882 call assert_equal(3, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
883 call assert_fails('tnext', 'E428:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
884 tfirst
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
885 call assert_equal(1, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
886 call assert_fails('tprev', 'E425:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
887
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
888 tlast
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
889 call feedkeys("5\<CR>", 't')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
890 tselect first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
891 call assert_equal(2, gettagstack().curidx)
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
892
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
893 set ignorecase
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
894 tag FIRST
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
895 tnext
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
896 call assert_equal(2, line('.'))
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
897 tlast
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
898 tprev
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
899 call assert_equal(2, line('.'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
900 tNext
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
901 call assert_equal(1, line('.'))
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
902 set ignorecase&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
903
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
904 call delete('Xtags')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
905 call delete('Xfoo')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
906 set tags&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
907 %bwipe
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
908 endfunc
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
909
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
910 " Test for previewing multiple matching tags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
911 func Test_preview_tag_multimatch()
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
912 call writefile([
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
913 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
914 \ "first\tXfoo\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
915 \ "first\tXfoo\t2",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
916 \ "first\tXfoo\t3"],
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
917 \ 'Xtags')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
918 set tags=Xtags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
919 let code =<< trim [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
920 int first() {}
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
921 int first() {}
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
922 int first() {}
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
923 [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
924 call writefile(code, 'Xfoo')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
925
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
926 enew | only
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
927 ptag first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
928 ptlast
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
929 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
930 call assert_equal(3, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
931 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
932 call assert_fails('ptnext', 'E428:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
933 ptprev
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
934 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
935 call assert_equal(2, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
936 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
937 ptfirst
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
938 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
939 call assert_equal(1, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
940 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
941 call assert_fails('ptprev', 'E425:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
942 ptnext
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
943 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
944 call assert_equal(2, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
945 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
946 ptlast
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
947 call feedkeys("5\<CR>", 't')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
948 ptselect first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
949 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
950 call assert_equal(3, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
951
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
952 pclose
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
953
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
954 call delete('Xtags')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
955 call delete('Xfoo')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
956 set tags&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
957 %bwipe
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
958 endfunc
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
959
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
960 " Test for jumping to multiple matching tags across multiple :tags commands
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
961 func Test_tnext_multimatch()
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
962 call writefile([
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
963 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
964 \ "first\tXfoo1\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
965 \ "first\tXfoo2\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
966 \ "first\tXfoo3\t1"],
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
967 \ 'Xtags')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
968 set tags=Xtags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
969 let code =<< trim [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
970 int first() {}
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
971 [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
972 call writefile(code, 'Xfoo1')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
973 call writefile(code, 'Xfoo2')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
974 call writefile(code, 'Xfoo3')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
975
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
976 tag first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
977 tag first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
978 pop
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
979 tnext
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
980 tnext
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
981 call assert_fails('tnext', 'E428:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
982
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
983 call delete('Xtags')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
984 call delete('Xfoo1')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
985 call delete('Xfoo2')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
986 call delete('Xfoo3')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
987 set tags&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
988 %bwipe
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
989 endfunc
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
990
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
991 " Test for jumping to multiple matching tags in non-existing files
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
992 func Test_multimatch_non_existing_files()
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
993 call writefile([
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
994 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
995 \ "first\tXfoo1\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
996 \ "first\tXfoo2\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
997 \ "first\tXfoo3\t1"],
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
998 \ 'Xtags')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
999 set tags=Xtags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1000
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1001 call settagstack(1, {'items' : []})
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1002 call assert_fails('tag first', 'E429:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1003 call assert_equal(3, gettagstack().items[0].matchnr)
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1004
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1005 call delete('Xtags')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1006 set tags&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1007 %bwipe
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1008 endfunc
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1009
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1010 func Test_tselect_listing()
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1011 call writefile([
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1012 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1013 \ "first\tXfoo\t1" .. ';"' .. "\tv\ttyperef:typename:int\tfile:",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1014 \ "first\tXfoo\t2" .. ';"' .. "\tv\ttyperef:typename:char\tfile:"],
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1015 \ 'Xtags')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1016 set tags=Xtags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1017
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1018 let code =<< trim [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1019 static int first;
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1020 static char first;
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1021 [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1022 call writefile(code, 'Xfoo')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1023
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1024 call feedkeys("\<CR>", "t")
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1025 let l = split(execute("tselect first"), "\n")
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1026 let expected =<< [DATA]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1027 # pri kind tag file
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1028 1 FS v first Xfoo
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1029 typeref:typename:int
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1030 1
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1031 2 FS v first Xfoo
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1032 typeref:typename:char
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1033 2
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1034 Type number and <Enter> (empty cancels):
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1035 [DATA]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1036 call assert_equal(expected, l)
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1037
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1038 call delete('Xtags')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1039 call delete('Xfoo')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1040 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1041 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1042 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1043
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1044 " Test for :isearch, :ilist, :ijump and :isplit commands
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1045 " Test for [i, ]i, [I, ]I, [ CTRL-I, ] CTRL-I and CTRL-W i commands
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1046 func Test_inc_search()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1047 new
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1048 call setline(1, ['1:foo', '2:foo', 'foo', '3:foo', '4:foo'])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1049 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1050
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1051 " Test for [i and ]i
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1052 call assert_equal('1:foo', execute('normal [i'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1053 call assert_equal('2:foo', execute('normal 2[i'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1054 call assert_fails('normal 3[i', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1055 call assert_equal('3:foo', execute('normal ]i'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1056 call assert_equal('4:foo', execute('normal 2]i'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1057 call assert_fails('normal 3]i', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1058
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1059 " Test for :isearch
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1060 call assert_equal('1:foo', execute('isearch foo'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1061 call assert_equal('3:foo', execute('isearch 4 /foo/'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1062 call assert_fails('isearch 3 foo', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1063 call assert_equal('3:foo', execute('+1,$isearch foo'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1064 call assert_fails('1,.-1isearch 3 foo', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1065 call assert_fails('isearch bar', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1066 call assert_fails('isearch /foo/3', 'E488:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1067
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1068 " Test for [I and ]I
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1069 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1070 \ ' 1: 1 1:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1071 \ ' 2: 2 2:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1072 \ ' 3: 3 foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1073 \ ' 4: 4 3:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1074 \ ' 5: 5 4:foo'], split(execute('normal [I'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1075 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1076 \ ' 1: 4 3:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1077 \ ' 2: 5 4:foo'], split(execute('normal ]I'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1078
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1079 " Test for :ilist
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1080 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1081 \ ' 1: 1 1:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1082 \ ' 2: 2 2:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1083 \ ' 3: 3 foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1084 \ ' 4: 4 3:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1085 \ ' 5: 5 4:foo'], split(execute('ilist foo'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1086 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1087 \ ' 1: 4 3:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1088 \ ' 2: 5 4:foo'], split(execute('+1,$ilist /foo/'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1089 call assert_fails('ilist bar', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1090
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1091 " Test for [ CTRL-I and ] CTRL-I
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1092 exe "normal [\t"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1093 call assert_equal([1, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1094 exe "normal 2j4[\t"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1095 call assert_equal([4, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1096 call assert_fails("normal k3[\t", 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1097 call assert_fails("normal 6[\t", 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1098 exe "normal ]\t"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1099 call assert_equal([4, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1100 exe "normal k2]\t"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1101 call assert_equal([5, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1102 call assert_fails("normal 2k3]\t", 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1103
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1104 " Test for :ijump
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1105 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1106 ijump foo
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1107 call assert_equal([1, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1108 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1109 ijump 4 /foo/
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1110 call assert_equal([4, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1111 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1112 call assert_fails('ijump 3 foo', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1113 +,$ijump 2 foo
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1114 call assert_equal([5, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1115 call assert_fails('ijump bar', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1116
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1117 " Test for CTRL-W i
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1118 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1119 wincmd i
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1120 call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1121 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1122 5wincmd i
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1123 call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1124 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1125 call assert_fails('3wincmd i', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1126 call assert_fails('6wincmd i', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1127
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1128 " Test for :isplit
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1129 isplit foo
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1130 call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1131 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1132 isplit 5 /foo/
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1133 call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1134 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1135 call assert_fails('isplit 3 foo', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1136 call assert_fails('isplit 6 foo', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1137 call assert_fails('isplit bar', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1138
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1139 close!
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1140 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1141
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1142 " Test for :dsearch, :dlist, :djump and :dsplit commands
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1143 " Test for [d, ]d, [D, ]D, [ CTRL-D, ] CTRL-D and CTRL-W d commands
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1144 func Test_macro_search()
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1145 new
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1146 call setline(1, ['#define FOO 1', '#define FOO 2', '#define FOO 3',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1147 \ '#define FOO 4', '#define FOO 5'])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1148 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1149
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1150 " Test for [d and ]d
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1151 call assert_equal('#define FOO 1', execute('normal [d'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1152 call assert_equal('#define FOO 2', execute('normal 2[d'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1153 call assert_fails('normal 3[d', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1154 call assert_equal('#define FOO 4', execute('normal ]d'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1155 call assert_equal('#define FOO 5', execute('normal 2]d'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1156 call assert_fails('normal 3]d', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1157
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1158 " Test for :dsearch
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1159 call assert_equal('#define FOO 1', execute('dsearch FOO'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1160 call assert_equal('#define FOO 5', execute('dsearch 5 /FOO/'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1161 call assert_fails('dsearch 3 FOO', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1162 call assert_equal('#define FOO 4', execute('+1,$dsearch FOO'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1163 call assert_fails('1,.-1dsearch 3 FOO', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1164 call assert_fails('dsearch BAR', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1165
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1166 " Test for [D and ]D
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1167 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1168 \ ' 1: 1 #define FOO 1',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1169 \ ' 2: 2 #define FOO 2',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1170 \ ' 3: 3 #define FOO 3',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1171 \ ' 4: 4 #define FOO 4',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1172 \ ' 5: 5 #define FOO 5'], split(execute('normal [D'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1173 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1174 \ ' 1: 4 #define FOO 4',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1175 \ ' 2: 5 #define FOO 5'], split(execute('normal ]D'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1176
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1177 " Test for :dlist
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1178 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1179 \ ' 1: 1 #define FOO 1',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1180 \ ' 2: 2 #define FOO 2',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1181 \ ' 3: 3 #define FOO 3',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1182 \ ' 4: 4 #define FOO 4',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1183 \ ' 5: 5 #define FOO 5'], split(execute('dlist FOO'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1184 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1185 \ ' 1: 4 #define FOO 4',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1186 \ ' 2: 5 #define FOO 5'], split(execute('+1,$dlist /FOO/'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1187 call assert_fails('dlist BAR', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1188
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1189 " Test for [ CTRL-D and ] CTRL-D
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1190 exe "normal [\<C-D>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1191 call assert_equal([1, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1192 exe "normal 2j4[\<C-D>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1193 call assert_equal([4, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1194 call assert_fails("normal k3[\<C-D>", 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1195 call assert_fails("normal 6[\<C-D>", 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1196 exe "normal ]\<C-D>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1197 call assert_equal([4, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1198 exe "normal k2]\<C-D>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1199 call assert_equal([5, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1200 call assert_fails("normal 2k3]\<C-D>", 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1201
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1202 " Test for :djump
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1203 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1204 djump FOO
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1205 call assert_equal([1, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1206 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1207 djump 4 /FOO/
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1208 call assert_equal([4, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1209 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1210 call assert_fails('djump 3 FOO', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1211 +,$djump 2 FOO
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1212 call assert_equal([5, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1213 call assert_fails('djump BAR', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1214
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1215 " Test for CTRL-W d
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1216 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1217 wincmd d
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1218 call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1219 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1220 5wincmd d
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1221 call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1222 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1223 call assert_fails('3wincmd d', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1224 call assert_fails('6wincmd d', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1225
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1226 " Test for :dsplit
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1227 dsplit FOO
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1228 call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1229 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1230 dsplit 5 /FOO/
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1231 call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1232 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1233 call assert_fails('dsplit 3 FOO', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1234 call assert_fails('dsplit 6 FOO', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1235 call assert_fails('dsplit BAR', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1236
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1237 close!
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1238 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1239
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1240 " Test for [*, [/, ]* and ]/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1241 func Test_comment_search()
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1242 new
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1243 call setline(1, ['', '/*', ' *', ' *', ' */'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1244 normal! 4gg[/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1245 call assert_equal([2, 1], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1246 normal! 3gg[*
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1247 call assert_equal([2, 1], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1248 normal! 3gg]/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1249 call assert_equal([5, 3], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1250 normal! 3gg]*
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1251 call assert_equal([5, 3], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1252 %d
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1253 call setline(1, ['', '/*', ' *', ' *'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1254 call assert_beeps('normal! 3gg]/')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1255 %d
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1256 call setline(1, ['', ' *', ' *', ' */'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1257 call assert_beeps('normal! 4gg[/')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1258 %d
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1259 call setline(1, ' /* comment */')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1260 normal! 15|[/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1261 call assert_equal(9, col('.'))
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1262 normal! 15|]/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1263 call assert_equal(21, col('.'))
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1264 call setline(1, ' comment */')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1265 call assert_beeps('normal! 15|[/')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1266 call setline(1, ' /* comment')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1267 call assert_beeps('normal! 15|]/')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1268 close!
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1269 endfunc
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1270
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
1271 " vim: shiftwidth=2 sts=2 expandtab