Mercurial > vim
annotate src/testdir/test_taglist.vim @ 16235:219c58b3879c v8.1.1122
patch 8.1.1122: char2nr() does not handle composing characters
commit https://github.com/vim/vim/commit/9d40128afd7fcd038ff6532722b55b1a8c189ce8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 6 13:18:12 2019 +0200
patch 8.1.1122: char2nr() does not handle composing characters
Problem: char2nr() does not handle composing characters.
Solution: Add str2list() and list2str(). (Ozaki Kiichi, closes https://github.com/vim/vim/issues/4190)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 06 Apr 2019 13:30:04 +0200 |
parents | d863beec391a |
children | 5cda6165a5c1 |
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:", |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
10 \ "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
|
11 \ ], 'Xtags') |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 set tags=Xtags |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 split Xtext |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo"), {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
|
16 call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xtext"), {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
|
17 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
|
18 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
|
19 |
15808
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
20 let kind = taglist("Kindly") |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
21 call assert_equal(1, len(kind)) |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
22 call assert_equal('v', kind[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
|
23 call assert_equal('3', kind[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
|
24 call assert_equal(1, kind[0]['static']) |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
25 call assert_equal('Xbar', kind[0]['filename']) |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
26 |
37d31fc37a5a
patch 8.1.0911: tag line with Ex command cannot have extra fields
Bram Moolenaar <Bram@vim.org>
parents:
14232
diff
changeset
|
27 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
|
28 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
|
29 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
|
30 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
|
31 |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call delete('Xtags') |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 bwipe |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 endfunc |
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 |
11329
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
36 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
|
37 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
|
38 return |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
39 endif |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
40 call writefile([ |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
41 \ "\x0c", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
42 \ "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
|
43 \ "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
|
44 \ "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
|
45 \ ], 'Xtags') |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
46 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
47 set tags=Xtags |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
48 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
49 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
|
50 \ 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
|
51 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
52 call delete('Xtags') |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
53 endfunc |
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 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
|
56 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
|
57 return |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
58 endif |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
59 call writefile([ |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
60 \ "\x0c", |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
61 \ "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
|
62 \ "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
|
63 \ "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
|
64 \ ], 'Xtags') |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
65 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
66 set tags=Xtags |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
67 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
68 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
|
69 \ 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
|
70 |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
71 call delete('Xtags') |
c7ba89661c39
patch 8.0.0550: cannot parse some etags format tags file
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
72 endfunc |
13068
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
73 |
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
74 func Test_tags_too_long() |
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
75 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
|
76 tags |
63fdea6e9c6c
patch 8.0.1409: buffer overflow in :tags command
Christian Brabandt <cb@256bit.org>
parents:
11329
diff
changeset
|
77 endfunc |
14232
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
78 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
79 func Test_tagfiles() |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
80 call assert_equal([], tagfiles()) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
81 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
82 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
|
83 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
|
84 set tags=Xtags1,Xtags2 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
85 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
|
86 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
87 help |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
88 let tf = tagfiles() |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
89 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
|
90 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
|
91 \ fnamemodify(tf[0], ':p:gs?\\?/?')) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
92 helpclose |
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 set tags& |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
95 call assert_equal([], tagfiles()) |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
96 |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
97 call delete('Xtags1') |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
98 call delete('Xtags2') |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
99 bd |
4afe2386aae8
patch 8.1.0133: tagfiles() can have duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13068
diff
changeset
|
100 endfunc |
16190
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
101 |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
102 " 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
|
103 " the newline. |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
104 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
|
105 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
|
106 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
|
107 |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
112 call delete('Xtags') |
d863beec391a
patch 8.1.1100: tag file without trailing newline no longer works
Bram Moolenaar <Bram@vim.org>
parents:
15808
diff
changeset
|
113 endfunc |