annotate src/testdir/test_tagjump.vim @ 18550:90e5812af76b v8.1.2269

patch 8.1.2269: tags file with very long line stops using binary search Commit: https://github.com/vim/vim/commit/dc9ef26845c6bf5ba63bfa8d00fc8a9bdc3b2de5 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 7 23:08:42 2019 +0100 patch 8.1.2269: tags file with very long line stops using binary search Problem: Tags file with very long line stops using binary search. Solution: Reallocate the buffer if needed.
author Bram Moolenaar <Bram@vim.org>
date Thu, 07 Nov 2019 23:15:04 +0100
parents b0b37bd807ba
children b9240fe40dd4
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()
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set notagstack
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 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
10 set tagstack&vim
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 endfunc
9228
ea504064c996 commit https://github.com/vim/vim/commit/fd89d7ea81b18d32363456b16258174dc9e095dc
Christian Brabandt <cb@256bit.org>
parents: 8934
diff changeset
12
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
13 func Test_cancel_ptjump()
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
14 set tags=Xtags
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
15 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
16 \ "word\tfile1\tcmd1",
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
17 \ "word\tfile2\tcmd2"],
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
18 \ 'Xtags')
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
19
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
20 only!
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
21 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
22 help
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
23 call assert_equal(2, winnr('$'))
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
24
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
25 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
26 set tags&
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
27 quit
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
28 endfunc
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
29
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
30 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
31 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
32 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
33 \ "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
34 \ "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
35 \ '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 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
37 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
38 write
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
39 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
40 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
41
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
42 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
43 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
44 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
45 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
46 endfunc
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
47
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
48 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
49 set tags=Xtags
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
50 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
51 \ "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
52 \ "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
53 \ "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
54 \ ],
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
55 \ 'Xtags')
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
56 new Xfile1
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
57 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
58 write
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
59 tag thesame
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
60 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
61 tnext
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
62 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
63 tnext
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(3, line('.'))
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
65
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
66 bwipe!
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
67 set tags&
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
68 call delete('Xtags')
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
69 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
70 endfunc
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
71
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
72 func Test_tagjump_switchbuf()
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
73 set tags=Xtags
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
74 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
75 \ "second\tXfile1\t2",
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
76 \ "third\tXfile1\t3",],
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
77 \ 'Xtags')
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
78 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
79
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
80 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
81 set switchbuf=
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
82 stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
83 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
84 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
85 stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
86 call assert_equal(3, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
87 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
88
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
89 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
90 set switchbuf=useopen
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
91 stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
92 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
93 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
94 stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
95 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
96 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
97
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
98 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
99 set switchbuf=usetab
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
100 tab stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
101 call assert_equal(2, tabpagenr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
102 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
103 1tabnext | stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
104 call assert_equal(2, tabpagenr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
105 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
106
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
107 tabclose!
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
108 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
109 call delete('Xfile1')
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
110 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
111 set tags&
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
112 set switchbuf&vim
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
113 endfunc
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
114
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
115 " 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
116 function Test_keyword_jump()
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
117 call writefile(["#include Xinclude", "",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
118 \ "",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
119 \ "/* test text test tex start here",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
120 \ " some text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
121 \ " test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
122 \ " start OK if found this line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
123 \ " start found wrong line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
124 \ "test text"], 'Xtestfile')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
125 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
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"], 'Xinclude')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
131 new Xtestfile
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
132 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
133 call search("start")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
134 exe "normal! 5[\<C-I>"
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
135 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
136 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
137 call search("start")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
138 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
139 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
140 enew! | only
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
141 call delete('Xtestfile')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
142 call delete('Xinclude')
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
143 endfunction
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
144
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
145 " 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
146 " 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
147 func Test_tag_symbolic()
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
148 if !has('unix')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
149 return
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
150 endif
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
151 set hidden
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
152 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
153 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
154 " 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
155 call writefile([
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
156 \ "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
157 \ '',
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
158 \ ], 'Xtags')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
159 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
160 \ '#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
161
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
162 " 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
163 " 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
164 " 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
165 set tags=Xtags
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
166 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
167 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
168 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
169 exe "normal \<C-]> "
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
170 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
171 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
172
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
173 set hidden&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
174 set tags&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
175 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
176 call delete('Xtags')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
177 call delete('Xtest.c')
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
178 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
179 %bwipe!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
180 endfunc
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
181
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
182 " 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
183 " 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
184 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
185 if has('vms')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
186 return
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
187 endif
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
188
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
189 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
190 return
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
191 endif
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
192
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
193 let save_enc = &encoding
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
194 set encoding=utf8
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
195
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
196 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
197 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
198 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
199 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
200 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
201 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
202 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
203 call writefile(content, 'Xtags1')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
204
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
205 " case1:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
206 new
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
207 set tags=Xtags1
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
208 tag abcdefghijklmnopqrs
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
209 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
210 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
211 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
212
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
213 " case2:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
214 new
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
215 set tags=test83-tags2
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
216 tag /.BC
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
217 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
218 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
219 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
220
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
221 " case3:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
222 new
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
223 set tags=test83-tags3
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
224 tag abc50
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
225 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
226 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
227 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
228
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
229 set tags&
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
230 let &encoding = save_enc
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
231 call delete('Xtags1.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
232 call delete('Xtags2.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
233 call delete('Xtags3.txt')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
234 call delete('Xtags1')
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
235 endfunc
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
236
13227
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
237 func Test_tagjump_etags()
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
238 if !has('emacs_tags')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
239 return
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
240 endif
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
241 call writefile([
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
242 \ "void foo() {}",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
243 \ "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
244 \ "{",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
245 \ "\tfoo();",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
246 \ "\treturn 0;",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
247 \ "}",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
248 \ ], 'Xmain.c')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
249
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
250 call writefile([
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
251 \ "\x0c",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
252 \ "Xmain.c,64",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
253 \ "void foo() {}\x7ffoo\x011,0",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
254 \ "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
255 \ ], 'Xtags')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
256 set tags=Xtags
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
257 ta foo
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
258 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
259
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
260 call delete('Xtags')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
261 call delete('Xmain.c')
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
262 bwipe!
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
263 endfunc
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
264
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
265 " 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
266 func Test_getsettagstack()
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
267 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
268 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
269 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
270
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
271 enew | only
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
272 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
273 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
274 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
275 " Error cases
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
276 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
277 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
278 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
279 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
280 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
281 call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
282
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
283 set tags=Xtags
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
284 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
285 \ "one\tXfile1\t1",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
286 \ "three\tXfile3\t3",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
287 \ "two\tXfile2\t2"],
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
288 \ 'Xtags')
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 let stk = []
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
291 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
292 \ '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
293 tag one
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
294 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
295 \ '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
296 tag two
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
297 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
298 \ '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
299 tag three
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
300 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
301 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
302 " 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
303 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
304 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
305
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
306 " 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
307 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
308 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
309 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
310 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
311
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
312 " 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
313 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
314 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
315 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
316 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
317 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
318 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
319 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
320 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
321 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
322 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
323 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
324 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
325 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
326
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
327 " 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
328 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
329 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
330 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
331 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
332 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
333 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
334 \ gettagstack(1))
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
335
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
336 " 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
337 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
338 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
339 endfor
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(20, gettagstack().length)
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
341 call settagstack(1,
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
342 \ {'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
343 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
344
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
345 " 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
346 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
347 \ "two\tXfile1\t1",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
348 \ "two\tXfile2\t3",
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
349 \ "two\tXfile3\t2"],
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
350 \ 'Xtags')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
351 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
352 tag two
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
353 tnext
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
354 tnext
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
355 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
356 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
357
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
358 " Memory allocation failures
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
359 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
360 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
361 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
362 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
363 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
364 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
365
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
366 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
367 call delete('Xfile1')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
368 call delete('Xfile2')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
369 call delete('Xfile3')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
370 call delete('Xtags')
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
371 set tags&
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
372 endfunc
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
373
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
374 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
375 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
376 \ '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
377 \ ], '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
378 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
379 \ '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
380 \ '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
381 \ ], '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
382 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
383 \ '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
384 \ '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
385 \ ], '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
386 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
387 \ '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
388 \ ], '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
389 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
390
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
391 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
392 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
393 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
394 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
395
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
396 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
397 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
398 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
399 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
400 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
401 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
402
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 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
404 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
405 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
406 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
407 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
408 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
409 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
410 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
411
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 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
413 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
414 \ '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
415 \ '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
416 \ '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
417 \ ], '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
418 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
419 \ '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
420 \ '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
421 \ ], '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 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
423 \ '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
424 \ ], '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
425 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
426
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 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
428 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
429 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
430 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
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 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
433 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
434 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
435 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
436 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
437 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
438
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
439 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
440 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
441 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
442 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
443 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
444 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
445 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
446
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
447 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
448 call writefile([
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
449 \ '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
450 \ ], 'Xtags')
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
451 set tags=Xtags
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
452 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
453 set verbose=5
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
454 " ":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
455 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
456 try
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
457 tj /foo
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
458 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
459 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
460 catch /.*/
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
461 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
462 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
463
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
464 call writefile([
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
465 \ '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
466 \ ], 'Xtags')
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
467 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
468 try
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
469 tj /foo
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
470 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
471 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
472 catch /.*/
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
473 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
474 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
475
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
476 " 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
477 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
478 \ '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
479 \ '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
480 \ '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
481 \ ], '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
482 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
483 \ '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
484 \ '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
485 \ '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
486 \ '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
487 \ ], '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
488 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
489 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
490 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
491
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
492 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
493 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
494 set tags&
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
495 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
496 endfunc
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
497
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
498 " 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
499 " 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
500 func Test_tselect()
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
501 CheckScreendump
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
502
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
503 call writefile([
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
504 \ '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
505 \ '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
506 \ '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
507 \ ], 'Xtags')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
508 cal writefile([
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
509 \ 'int main()',
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
510 \ 'void test()',
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
511 \ ], 'Xtest.c')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
512
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
513 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
514 set tags=Xtags
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
515 [SCRIPT]
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
516 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
517 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
518
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
519 call term_wait(buf, 100)
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
520 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
521 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
522
18297
b0b37bd807ba patch 8.1.2143: cannot see each command even when 'verbose' is set
Bram Moolenaar <Bram@vim.org>
parents: 18293
diff changeset
523 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
524 call delete('Xtags')
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
525 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
526 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
527 endfunc
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
528
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
529 " vim: shiftwidth=2 sts=2 expandtab