Mercurial > vim
annotate src/testdir/test_taglist.vim @ 19617:5ce724c60c4c v8.2.0365
patch 8.2.0365: tag kind can't be a multi-byte character
Commit: https://github.com/vim/vim/commit/283e5f4e69b204e0eafd408548e69b7ca9b4871b
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 9 08:17:52 2020 +0100
patch 8.2.0365: tag kind can't be a multi-byte character
Problem: Tag kind can't be a multi-byte character. (Marcin Szamotulski)
Solution: Recognize multi-byte character. (closes https://github.com/vim/vim/issues/5724)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 09 Mar 2020 08:30:04 +0100 |
parents | 8645b73b3645 |
children | 9199f34d838e |
rev | line source |
---|---|
14232
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
1 " test taglist(), tagfiles() functions and :tags command |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_taglist() |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 call writefile([ |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 \ "FFoo\tXfoo\t1", |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 \ "FBar\tXfoo\t2", |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 \ "BFoo\tXbar\t1", |
15808
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
8 \ "BBar\tXbar\t2", |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
9 \ "Kindly\tXbar\t3;\"\tv\tfile:", |
19617
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
10 \ "Lambda\tXbar\t3;\"\tλ\tfile:", |
15808
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
11 \ "Command\tXbar\tcall cursor(3, 4)|;\"\td", |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 \ ], 'Xtags') |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 set tags=Xtags |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 split Xtext |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo"), {i, v -> v.name})) |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17093
diff
changeset
|
17 call assert_equal(['FFoo', 'BFoo'], map("Foo"->taglist("Xtext"), {i, v -> v.name})) |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xfoo"), {i, v -> v.name})) |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal(['BFoo', 'FFoo'], map(taglist("Foo", "Xbar"), {i, v -> v.name})) |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
19617
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
21 let kindly = taglist("Kindly") |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
22 call assert_equal(1, len(kindly)) |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
23 call assert_equal('v', kindly[0]['kind']) |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
24 call assert_equal('3', kindly[0]['cmd']) |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
25 call assert_equal(1, kindly[0]['static']) |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
26 call assert_equal('Xbar', kindly[0]['filename']) |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
27 |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
28 let lambda = taglist("Lambda") |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
29 call assert_equal(1, len(lambda)) |
5ce724c60c4c
patch 8.2.0365: tag kind can't be a multi-byte character
Bram Moolenaar <Bram@vim.org>
parents:
19055
diff
changeset
|
30 call assert_equal('λ', lambda[0]['kind']) |
15808
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
31 |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
32 let cmd = taglist("Command") |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
33 call assert_equal(1, len(cmd)) |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
34 call assert_equal('d', cmd[0]['kind']) |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
35 call assert_equal('call cursor(3, 4)', cmd[0]['cmd']) |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
36 |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call delete('Xtags') |
17093
5cda6165a5c1
patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents:
16190
diff
changeset
|
38 set tags& |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 bwipe |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 endfunc |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 |
11329
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
42 func Test_taglist_native_etags() |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
43 if !has('emacs_tags') |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
44 return |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
45 endif |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
46 call writefile([ |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
47 \ "\x0c", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
48 \ "src/os_unix.c,13491", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
49 \ "set_signals(\x7f1335,32699", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
50 \ "reset_signals(\x7f1407,34136", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
51 \ ], 'Xtags') |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
52 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
53 set tags=Xtags |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
54 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
55 call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']], |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
56 \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]})) |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
57 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
58 call delete('Xtags') |
17093
5cda6165a5c1
patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents:
16190
diff
changeset
|
59 set tags& |
11329
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
60 endfunc |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
61 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
62 func Test_taglist_ctags_etags() |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
63 if !has('emacs_tags') |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
64 return |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
65 endif |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
66 call writefile([ |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
67 \ "\x0c", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
68 \ "src/os_unix.c,13491", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
69 \ "set_signals(void)\x7fset_signals\x011335,32699", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
70 \ "reset_signals(void)\x7freset_signals\x011407,34136", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
71 \ ], 'Xtags') |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
72 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
73 set tags=Xtags |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
74 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
75 call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']], |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
76 \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]})) |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
77 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
78 call delete('Xtags') |
17093
5cda6165a5c1
patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents:
16190
diff
changeset
|
79 set tags& |
11329
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
80 endfunc |
13068
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
81 |
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
82 func Test_tags_too_long() |
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
83 call assert_fails('tag ' . repeat('x', 1020), 'E426') |
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
84 tags |
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
85 endfunc |
14232
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
86 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
87 func Test_tagfiles() |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
88 call assert_equal([], tagfiles()) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
89 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
90 call writefile(["FFoo\tXfoo\t1"], 'Xtags1') |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
91 call writefile(["FBar\tXbar\t1"], 'Xtags2') |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
92 set tags=Xtags1,Xtags2 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
93 call assert_equal(['Xtags1', 'Xtags2'], tagfiles()) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
94 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
95 help |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
96 let tf = tagfiles() |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
97 call assert_equal(1, len(tf)) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
98 call assert_equal(fnamemodify(expand('$VIMRUNTIME/doc/tags'), ':p:gs?\\?/?'), |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
99 \ fnamemodify(tf[0], ':p:gs?\\?/?')) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
100 helpclose |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
101 call assert_equal(['Xtags1', 'Xtags2'], tagfiles()) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
102 set tags& |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
103 call assert_equal([], tagfiles()) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
104 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
105 call delete('Xtags1') |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
106 call delete('Xtags2') |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
107 bd |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
108 endfunc |
16190
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
109 |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
110 " For historical reasons we support a tags file where the last line is missing |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
111 " the newline. |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
112 func Test_tagsfile_without_trailing_newline() |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
113 call writefile(["Foo\tfoo\t1"], 'Xtags', 'b') |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
114 set tags=Xtags |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
115 |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
116 let tl = taglist('.*') |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
117 call assert_equal(1, len(tl)) |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
118 call assert_equal('Foo', tl[0].name) |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
119 |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
120 call delete('Xtags') |
17093
5cda6165a5c1
patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents:
16190
diff
changeset
|
121 set tags& |
16190
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
122 endfunc |
19055
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
123 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
124 " Test for ignoring comments in a tags file |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
125 func Test_tagfile_ignore_comments() |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
126 call writefile([ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
127 \ "!_TAG_PROGRAM_NAME /Test tags generator/", |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
128 \ "FBar\tXfoo\t2" .. ';"' .. "\textrafield\tf", |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
129 \ "!_TAG_FILE_FORMAT 2 /extended format/", |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
130 \ ], 'Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
131 set tags=Xtags |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
132 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
133 let l = taglist('.*') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
134 call assert_equal(1, len(l)) |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
135 call assert_equal('FBar', l[0].name) |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
136 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
137 set tags& |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
138 call delete('Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
139 endfunc |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
140 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
141 " Test for using an excmd in a tags file to position the cursor (instead of a |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
142 " search pattern or a line number) |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
143 func Test_tagfile_excmd() |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
144 call writefile([ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
145 \ "vFoo\tXfoo\tcall cursor(3, 4)" .. '|;"' .. "\tv", |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
146 \ ], 'Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
147 set tags=Xtags |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
148 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
149 let l = taglist('.*') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
150 call assert_equal([{ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
151 \ 'cmd' : 'call cursor(3, 4)', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
152 \ 'static' : 0, |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
153 \ 'name' : 'vFoo', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
154 \ 'kind' : 'v', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
155 \ 'filename' : 'Xfoo'}], l) |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
156 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
157 set tags& |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
158 call delete('Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
159 endfunc |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
160 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
161 " Test for duplicate fields in a tag in a tags file |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
162 func Test_duplicate_field() |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
163 call writefile([ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
164 \ "vFoo\tXfoo\t4" .. ';"' .. "\ttypename:int\ttypename:int\tv", |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
165 \ ], 'Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
166 set tags=Xtags |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
167 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
168 let l = taglist('.*') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
169 call assert_equal([{ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
170 \ 'cmd' : '4', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
171 \ 'static' : 0, |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
172 \ 'name' : 'vFoo', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
173 \ 'kind' : 'v', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
174 \ 'typename' : 'int', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
175 \ 'filename' : 'Xfoo'}], l) |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
176 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
177 set tags& |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
178 call delete('Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
179 endfunc |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
180 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
181 " Test for tag address with ; |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
182 func Test_tag_addr_with_semicolon() |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
183 call writefile([ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
184 \ "Func1\tXfoo\t6;/^Func1/" .. ';"' .. "\tf" |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
185 \ ], 'Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
186 set tags=Xtags |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
187 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
188 let l = taglist('.*') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
189 call assert_equal([{ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
190 \ 'cmd' : '6;/^Func1/', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
191 \ 'static' : 0, |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
192 \ 'name' : 'Func1', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
193 \ 'kind' : 'f', |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
194 \ 'filename' : 'Xfoo'}], l) |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
195 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
196 set tags& |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
197 call delete('Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
198 endfunc |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
199 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
200 " Test for format error in a tags file |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
201 func Test_format_error() |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
202 call writefile(['vFoo-Xfoo-4'], 'Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
203 set tags=Xtags |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
204 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
205 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:
18031
diff
changeset
|
206 try |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
207 let l = taglist('.*') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
208 catch /E431:/ |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
209 " test succeeded |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
210 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:
18031
diff
changeset
|
211 catch |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
212 call assert_report('Caught ' . v:exception . ' in ' . v:throwpoint) |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
213 endtry |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
214 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:
18031
diff
changeset
|
215 |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
216 set tags& |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
217 call delete('Xtags') |
8645b73b3645
patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
218 endfunc |