annotate src/testdir/test_tagjump.vim @ 31343:97bb0811cfd4 v9.0.1005

patch 9.0.1005: a failed test may leave a swap file behind Commit: https://github.com/vim/vim/commit/d0f8d39d20f8d42f7451f781f7be0bcd20e06741 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 4 23:00:41 2022 +0000 patch 9.0.1005: a failed test may leave a swap file behind Problem: A failed test may leave a swap file behind. Solution: Delete the swap file to avoid another test to fail. Use another file name.
author Bram Moolenaar <Bram@vim.org>
date Mon, 05 Dec 2022 00:15:06 +0100
parents c8ebe35b2475
children 56a2af8c0980
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8934
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for tagjump (tags and special searches)
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
3 source check.vim
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
4 source screendump.vim
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
5
8934
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " SEGV occurs in older versions. (At least 7.4.1748 or older)
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_ptag_with_notagstack()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
8 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
9
8934
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 set notagstack
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
11 call assert_fails('ptag does_not_exist_tag_name', 'E433:')
8934
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 set tagstack&vim
42c8599421e5 commit https://github.com/vim/vim/commit/8d8aa0a367380f23f0af428fcb66a1a0615bf872
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endfunc
9228
ea504064c996 commit https://github.com/vim/vim/commit/fd89d7ea81b18d32363456b16258174dc9e095dc
Christian Brabandt <cb@256bit.org>
parents: 8934
diff changeset
14
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
15 func Test_ptjump()
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
16 CheckFeature quickfix
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
17
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
18 set tags=Xpttags
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
19 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
20 \ "one\tXptfile\t1",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
21 \ "three\tXptfile\t3",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
22 \ "two\tXptfile\t2"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
23 \ 'Xpttags', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
24 call writefile(['one', 'two', 'three'], 'Xptfile', 'D')
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
25
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
26 %bw!
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
27 ptjump two
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
28 call assert_equal(2, winnr())
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
29 wincmd p
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
30 call assert_equal(1, &previewwindow)
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
31 call assert_equal('Xptfile', expand("%:p:t"))
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
32 call assert_equal(2, line('.'))
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
33 call assert_equal(2, winnr('$'))
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
34 call assert_equal(1, winnr())
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
35 close
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
36 call setline(1, ['one', 'two', 'three'])
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
37 exe "normal 3G\<C-W>g}"
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
38 call assert_equal(2, winnr())
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
39 wincmd p
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
40 call assert_equal(1, &previewwindow)
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
41 call assert_equal('Xptfile', expand("%:p:t"))
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
42 call assert_equal(3, line('.'))
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
43 call assert_equal(2, winnr('$'))
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
44 call assert_equal(1, winnr())
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
45 close
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
46 exe "normal 3G5\<C-W>\<C-G>}"
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
47 wincmd p
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
48 call assert_equal(5, winheight(0))
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
49 close
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
50
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
51 set tags&
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
52 endfunc
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
53
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
54 func Test_cancel_ptjump()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
55 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
56
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
57 set tags=Xtags
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
58 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
59 \ "word\tfile1\tcmd1",
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
60 \ "word\tfile2\tcmd2"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
61 \ 'Xtags', 'D')
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
62
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
63 only!
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
64 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
65 help
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
66 call assert_equal(2, winnr('$'))
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
67
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
68 set tags&
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
69 quit
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
70 endfunc
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
71
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
72 func Test_static_tagjump()
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
73 set tags=Xtjtags
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
74 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
75 \ "one\tXtjfile1\t/^one/;\"\tf\tfile:\tsignature:(void)",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
76 \ "word\tXtjfile2\tcmd2"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
77 \ 'Xtjtags', 'D')
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
78 new Xtjfile1
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
79 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
80 write
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
81 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
82 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
83
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
84 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
85 set tags&
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
86 call delete('Xtjfile1')
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
87 endfunc
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
88
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
89 func Test_duplicate_tagjump()
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
90 set tags=Xdttags
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
91 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
92 \ "thesame\tXdtfile1\t1;\"\td\tfile:",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
93 \ "thesame\tXdtfile1\t2;\"\td\tfile:",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
94 \ "thesame\tXdtfile1\t3;\"\td\tfile:",
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
95 \ ],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
96 \ 'Xdttags', 'D')
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
97 new Xdtfile1
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
98 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
99 write
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
100 tag thesame
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
101 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
102 tnext
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
103 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
104 tnext
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
105 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
106
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
107 bwipe!
11008
0ecd07cd2e43 patch 8.0.0393: order of duplicate tags is not preserved
Christian Brabandt <cb@256bit.org>
parents: 10611
diff changeset
108 set tags&
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
109 call delete('Xdtfile1')
10611
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
110 endfunc
6bff81438f27 patch 8.0.0195: fail to jump to static tag in current file
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
111
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
112 func Test_tagjump_switchbuf()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
113 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18640
diff changeset
114
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
115 set tags=Xswtags
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
116 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
117 \ "second\tXsbfile1\t2",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
118 \ "third\tXsbfile1\t3",],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
119 \ 'Xswtags', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
120 call writefile(['first', 'second', 'third'], 'Xsbfile1', 'D')
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
121
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
122 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
123 set switchbuf=
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
124 stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
125 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
126 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
127 stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
128 call assert_equal(3, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
129 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
130
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
131 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
132 set switchbuf=useopen
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
133 stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
134 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
135 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
136 stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
137 call assert_equal(2, winnr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
138 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
139
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
140 enew | only
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
141 set switchbuf=usetab
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
142 tab stag second
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
143 call assert_equal(2, tabpagenr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
144 call assert_equal(2, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
145 1tabnext | stag third
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
146 call assert_equal(2, tabpagenr('$'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
147 call assert_equal(3, line('.'))
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
148
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
149 tabclose!
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
150 enew | only
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
151 set tags&
11476
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
152 set switchbuf&vim
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
153 endfunc
c45fb081391c patch 8.0.0621: :stag does not respect 'switchbuf'
Christian Brabandt <cb@256bit.org>
parents: 11008
diff changeset
154
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
155 " 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
156 function Test_keyword_jump()
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
157 call writefile(["#include Xinclude", "",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
158 \ "",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
159 \ "/* test text test tex start here",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
160 \ " some text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
161 \ " test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
162 \ " start OK if found this line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
163 \ " start found wrong line",
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
164 \ "test text"], 'Xtestfile', 'D')
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
165 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
166 \ " some text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
167 \ " test text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
168 \ " start OK if found this line",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
169 \ " start found wrong line",
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
170 \ "test text"], 'Xinclude', 'D')
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
171 new Xtestfile
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
172 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
173 call search("start")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
174 exe "normal! 5[\<C-I>"
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
175 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
176 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
177 call search("start")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
178 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
179 call assert_equal(" start OK if found this line", getline('.'))
22375
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
180
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
181 " invalid tag search pattern
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
182 call assert_fails('tag /\%(/', 'E426:')
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
183
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
184 enew! | only
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
185 endfunction
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
186
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
187 " 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
188 " 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
189 func Test_tag_symbolic()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
190 CheckUnix
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
191
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
192 set hidden
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
193 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
194 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
195 " 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
196 call writefile([
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
197 \ "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
198 \ '',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
199 \ ], 'Xsymtags', 'D')
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
200 call writefile(['#define SECTION_OFF 3',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
201 \ '#define NUM_SECTIONS 3'], 'Xtest.c', 'D')
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
202
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
203 " 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
204 " 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
205 " eaten by hit-return, instead of moving the cursor to 'd'.
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
206 set tags=Xsymtags
12686
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
207 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
208 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
209 call cursor(1,1)
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
210 exe "normal \<C-]> "
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
211 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
212 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
213
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
214 set hidden&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
215 set tags&
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
216 enew!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
217 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
218 %bwipe!
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
219 endfunc
aa658b33f25a patch 8.0.1221: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 11476
diff changeset
220
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
221 " 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
222 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
223 if has('vms')
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
224 throw 'Skipped: does not work on VMS'
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
225 endif
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
226
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
227 if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21"
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
228 throw 'Skipped: iconv does not work'
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
229 endif
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
230
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
231 let save_enc = &encoding
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
232 set encoding=utf8
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
233
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
234 let content = ['text for tags1', 'abcdefghijklmnopqrs']
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
235 call writefile(content, 'Xtags1.txt', 'D')
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
236 let content = ['text for tags2', 'ABC']
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
237 call writefile(content, 'Xtags2.txt', 'D')
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
238 let content = ['text for tags3', 'ABC']
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
239 call writefile(content, 'Xtags3.txt', 'D')
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
240 let content = ['!_TAG_FILE_ENCODING utf-8 //', 'abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs']
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
241 call writefile(content, 'Xtags1', 'D')
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
242
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
243 " case1:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
244 new
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
245 set tags=Xtags1
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
246 tag abcdefghijklmnopqrs
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
247 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
248 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
249 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
250
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
251 " case2:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
252 new
27974
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
253 let content = ['!_TAG_FILE_ENCODING cp932 //',
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
254 \ "\x82`\x82a\x82b Xtags2.txt /\x82`\x82a\x82b"]
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
255 call writefile(content, 'Xenctags')
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
256 set tags=Xenctags
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
257 tag /.BC
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
258 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
259 call assert_equal('ABC', getline('.'))
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
260 call delete('Xenctags')
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
261 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
262
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
263 " case3:
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
264 new
27974
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
265 let contents = [
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
266 \ "!_TAG_FILE_SORTED 1 //",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
267 \ "!_TAG_FILE_ENCODING cp932 //"]
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
268 for i in range(1, 100)
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
269 call add(contents, 'abc' .. i
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
270 \ .. " Xtags3.txt /\x82`\x82a\x82b")
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
271 endfor
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
272 call writefile(contents, 'Xenctags', 'D')
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
273 set tags=Xenctags
12750
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
274 tag abc50
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
275 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
276 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
277 close
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
278
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
279 set tags&
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
280 let &encoding = save_enc
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
281 endfunc
0b6c09957b43 patch 8.0.1253: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12686
diff changeset
282
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
283 " Test for emacs-style tags file (TAGS)
13227
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
284 func Test_tagjump_etags()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
285 CheckFeature emacs_tags
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
286
13227
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
287 call writefile([
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
288 \ "void foo() {}",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
289 \ "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
290 \ "{",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
291 \ "\tfoo();",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
292 \ "\treturn 0;",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
293 \ "}",
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
294 \ ], 'Xmain.c', 'D')
13227
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
295
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
296 call writefile([
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
297 \ "\x0c",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
298 \ "Xmain.c,64",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
299 \ "void foo() {}\x7ffoo\x011,0",
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
300 \ "int main(int argc, char **argv)\x7fmain\x012,14",
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
301 \ ], 'Xtetags', 'D')
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
302 set tags=Xtetags
13227
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
303 ta foo
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
304 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
305
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
306 " Test for including another tags file
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
307 call writefile([
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
308 \ "\x0c",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
309 \ "Xmain.c,64",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
310 \ "void foo() {}\x7ffoo\x011,0",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
311 \ "\x0c",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
312 \ "Xnonexisting,include",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
313 \ "\x0c",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
314 \ "Xtags2,include"
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
315 \ ], 'Xtetags')
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
316 call writefile([
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
317 \ "\x0c",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
318 \ "Xmain.c,64",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
319 \ "int main(int argc, char **argv)\x7fmain\x012,14",
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
320 \ ], 'Xtags2', 'D')
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
321 tag main
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
322 call assert_equal(2, line('.'))
27974
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
323 call assert_fails('tag bar', 'E426:')
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
324
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
325 " corrupted tag line
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
326 call writefile([
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
327 \ "\x0c",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
328 \ "Xmain.c,8",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
329 \ "int main"
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
330 \ ], 'Xtetags', 'b')
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
331 call assert_fails('tag foo', 'E426:')
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
332
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
333 " invalid line number
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
334 call writefile([
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
335 \ "\x0c",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
336 \ "Xmain.c,64",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
337 \ "void foo() {}\x7ffoo\x0abc,0",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
338 \ ], 'Xtetags')
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
339 call assert_fails('tag foo', 'E426:')
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
340
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
341 " invalid tag name
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
342 call writefile([
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
343 \ "\x0c",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
344 \ "Xmain.c,64",
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
345 \ ";;;;\x7f1,0",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
346 \ ], 'Xtetags')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
347 call assert_fails('tag foo', 'E431:')
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
348
27974
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
349 " end of file after a CTRL-L line
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
350 call writefile([
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
351 \ "\x0c",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
352 \ "Xmain.c,64",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
353 \ "void foo() {}\x7ffoo\x011,0",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
354 \ "\x0c",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
355 \ ], 'Xtetags')
27974
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
356 call assert_fails('tag main', 'E426:')
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
357
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
358 " error in an included tags file
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
359 call writefile([
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
360 \ "\x0c",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
361 \ "Xtags2,include"
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
362 \ ], 'Xtetags')
27974
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
363 call writefile([
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
364 \ "\x0c",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
365 \ "Xmain.c,64",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
366 \ "void foo() {}",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
367 \ ], 'Xtags2')
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
368 call assert_fails('tag foo', 'E431:')
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
369
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
370 set tags&
13227
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
371 bwipe!
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
372 endfunc
b88fa651c824 patch 8.0.1488: emacs tags no longer work
Christian Brabandt <cb@256bit.org>
parents: 12750
diff changeset
373
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
374 " 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
375 func Test_getsettagstack()
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
376 call writefile(['line1', 'line2', 'line3'], 'Xstsfile1', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
377 call writefile(['line1', 'line2', 'line3'], 'Xstsfile2', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
378 call writefile(['line1', 'line2', 'line3'], 'Xstsfile3', 'D')
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
379
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
380 enew | only
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
381 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
382 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
383 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
384 " Error cases
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
385 call assert_equal({}, gettagstack(100))
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
386 call assert_equal(-1, settagstack(100, {'items' : []}))
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 29056
diff changeset
387 call assert_fails('call settagstack(1, [1, 10])', 'E1206:')
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
388 call assert_fails("call settagstack(1, {'items' : 10})", 'E714:')
30043
fd855ad74887 patch 9.0.0359: error message for wrong argument type is not specific
Bram Moolenaar <Bram@vim.org>
parents: 29994
diff changeset
389 call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E1174:')
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
390 call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962:')
20120
16460964c304 patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
391 call assert_equal(-1, settagstack(0, test_null_dict()))
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
392
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
393 set tags=Xtsttags
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
394 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
395 \ "one\tXstsfile1\t1",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
396 \ "three\tXstsfile3\t3",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
397 \ "two\tXstsfile2\t2"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
398 \ 'Xtsttags', 'D')
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
399
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
400 let stk = []
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
401 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
402 \ '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
403 tag one
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
404 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
405 \ '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
406 tag two
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
407 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
408 \ '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
409 tag three
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
410 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
411 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
412 " 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
413 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
414 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
415
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
416 " 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
417 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
418 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
419 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
420 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
421
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
422 " 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
423 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
424 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
425 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
434 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
435 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
436
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
437 " 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
438 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
439 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
440 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
441 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
442 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
443 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
444 \ gettagstack(1))
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
445
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
446 " 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
447 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
448 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
449 endfor
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
450 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
451 call settagstack(1,
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
452 \ {'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
453 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
454
19033
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
455 " truncate the tag stack
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
456 call settagstack(1,
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
457 \ {'curidx' : 9,
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
458 \ 'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
459 let t = gettagstack()
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
460 call assert_equal(9, t.length)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
461 call assert_equal(10, t.curidx)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
462
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
463 " truncate the tag stack without pushing any new items
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
464 call settagstack(1, {'curidx' : 5}, 't')
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
465 let t = gettagstack()
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
466 call assert_equal(4, t.length)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
467 call assert_equal(5, t.curidx)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
468
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
469 " truncate an empty tag stack and push new items
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
470 call settagstack(1, {'items' : []})
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
471 call settagstack(1,
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
472 \ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
473 let t = gettagstack()
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
474 call assert_equal(1, t.length)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
475 call assert_equal(2, t.curidx)
f0312cf3c792 patch 8.2.0077: settagstack() cannot truncate at current index
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
476
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
477 " 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
478 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
479 \ "two\tXstsfile1\t1",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
480 \ "two\tXstsfile2\t3",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
481 \ "two\tXstsfile3\t2"],
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
482 \ 'Xtsttags')
15016
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
483 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
484 tag two
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
485 tnext
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
486 tnext
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
487 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
488 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
489
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
490 " Memory allocation failures
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
491 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
492 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
493 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
494 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
495 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
496 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
497
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
498 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
499 set tags&
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
500 endfunc
c338c91086b9 patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents: 13227
diff changeset
501
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
502 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
503 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
504 \ 'test Xtest.h /^void test();$/;" p typeref:typename:void signature:()',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
505 \ ], 'Xtags', 'D')
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
506 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
507 \ '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
508 \ 'test Xtest.c /^void test()$/;" f typeref:typename:void signature:()',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
509 \ ], 'Ytags', 'D')
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
510 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
511 \ '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
512 \ 'void test()',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
513 \ ], 'Xtest.c', 'D')
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
514 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
515 \ 'void test();',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
516 \ ], 'Xtest.h', 'D')
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
517 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
518
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
519 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
520 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
521 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
522 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
523
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
524 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
525 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
526 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
527 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
528 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
529 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
530
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
531 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
532 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
533 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
534 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
535
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
536 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
537 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
538 \ '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
539 \ '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
540 \ 'test Xtest.c /^void test()$/;" f',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
541 \ ], 'Xtags', 'D')
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
542 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
543 \ '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
544 \ 'void test()',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
545 \ ], 'Xtest.c', 'D')
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
546 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
547 \ 'void test();',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
548 \ ], 'Xtest.h', 'D')
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
549 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
550
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
551 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
552 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
553 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
554 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
555
213b88f89597 patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Bram Moolenaar <Bram@vim.org>
parents: 15016
diff changeset
556 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
557 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
558 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
559 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
560 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
561 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
562
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
563 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
564 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
565 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
566 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
567
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
568 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
569 call writefile([
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
570 \ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
571 \ ], 'Xtags', 'D')
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
572 set tags=Xtags
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
573 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
574 set verbose=5
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
575 " ":tjump" should give "tag not found" not "Format error in tags file"
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
576 call assert_fails('tj /foo', 'E426:')
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
577 try
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
578 tj /foo
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
579 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
580 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
581 catch /.*/
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
582 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
583 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
584
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
585 call writefile([
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
586 \ '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
587 \ ], 'Xtags')
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
588 call assert_fails('tj /foo', 'E426:')
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
589 try
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
590 tj /foo
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
591 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
592 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
593 catch /.*/
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
594 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
595 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
596
90e5812af76b patch 8.1.2269: tags file with very long line stops using binary search
Bram Moolenaar <Bram@vim.org>
parents: 18297
diff changeset
597 " 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
598 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
599 \ '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
600 \ '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
601 \ '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
602 \ ], '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
603 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
604 \ '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
605 \ '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
606 \ '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
607 \ 'four',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
608 \ ], 'Xsomewhere', 'D')
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
609 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
610 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
611 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
612
25652
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
613 " expansion on command line works with long lines when &wildoptions contains
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
614 " 'tagfile'
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
615 set wildoptions=tagfile
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
616 call writefile([
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
617 \ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa file /^pattern$/;" f'
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
618 \ ], 'Xtags')
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
619 call feedkeys(":tag \<Tab>", 'tx')
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
620 " Should not crash
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
621 call assert_true(v:true)
ca61340ac1b9 patch 8.2.3362: buffer overflow when completing long tag name
Bram Moolenaar <Bram@vim.org>
parents: 24964
diff changeset
622
17093
5cda6165a5c1 patch 8.1.1546: in some tests 'tags' is set but not restored
Bram Moolenaar <Bram@vim.org>
parents: 16178
diff changeset
623 set tags&
16178
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
624 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
625 endfunc
a8689ea2e869 patch 8.1.1094: long line in tags file causes error
Bram Moolenaar <Bram@vim.org>
parents: 16164
diff changeset
626
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
627 " 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
628 " 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
629 func Test_tselect()
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
630 CheckScreendump
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
631
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
632 call writefile([
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
633 \ '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
634 \ '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
635 \ 'main Xtest.x /^void test()$/;" f',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
636 \ ], 'Xtags', 'D')
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
637 cal writefile([
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
638 \ 'int main()',
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
639 \ 'void test()',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
640 \ ], 'Xtest.c', 'D')
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
641
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
642 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
643 set tags=Xtags
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
644 [SCRIPT]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
645 call writefile(lines, 'XTest_tselect', 'D')
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
646 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
647
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
648 call TermWait(buf, 50)
18293
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
649 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
650 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
651
18297
b0b37bd807ba patch 8.1.2143: cannot see each command even when 'verbose' is set
Bram Moolenaar <Bram@vim.org>
parents: 18293
diff changeset
652 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
653 endfunc
1c5974759bcd patch 8.1.2141: :tselect has an extra hit-enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 18000
diff changeset
654
18640
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
655 func Test_tagline()
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
656 call writefile([
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
657 \ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:1 language:Python class:Foo',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
658 \ 'provision Xtest.py /^ def provision(self, **kwargs):$/;" m line:3 language:Python class:Bar',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
659 \], 'Xtags', 'D')
18640
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
660 call writefile([
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
661 \ ' def provision(self, **kwargs):',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
662 \ ' pass',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
663 \ ' def provision(self, **kwargs):',
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
664 \ ' pass',
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
665 \], 'Xtest.py', 'D')
18640
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
666
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
667 set tags=Xtags
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
668
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
669 1tag provision
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
670 call assert_equal(line('.'), 1)
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
671 2tag provision
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
672 call assert_equal(line('.'), 3)
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
673
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
674 set tags&
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
675 endfunc
b9240fe40dd4 patch 8.1.2312: "line:" field in tags file not used
Bram Moolenaar <Bram@vim.org>
parents: 18550
diff changeset
676
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
677 " Test for expanding environment variable in a tag file name
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
678 func Test_tag_envvar()
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
679 call writefile(["Func1\t$FOO\t/^Func1/"], 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
680 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
681
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
682 let $FOO='TagTestEnv'
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
683
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
684 let caught_exception = v:false
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
685 try
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
686 tag Func1
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
687 catch /E429:/
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
688 call assert_match('E429:.*"TagTestEnv".*', v:exception)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
689 let caught_exception = v:true
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
690 endtry
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
691 call assert_true(caught_exception)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
692
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
693 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
694 unlet $FOO
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
695 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
696
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
697 " Test for :ptag
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
698 func Test_tag_preview()
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
699 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
700 \ "second\tXtpfile1\t2",
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
701 \ "third\tXtpfile1\t3",],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
702 \ 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
703 set tags=Xtags
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
704 call writefile(['first', 'second', 'third'], 'Xtpfile1', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
705
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
706 enew | only
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
707 ptag third
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
708 call assert_equal(2, winnr())
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
709 call assert_equal(2, winnr('$'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
710 call assert_equal(1, getwinvar(1, '&previewwindow'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
711 call assert_equal(0, getwinvar(2, '&previewwindow'))
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
712 wincmd P
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
713 call assert_equal(3, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
714
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
715 " jump to the tag again
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
716 wincmd w
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
717 ptag third
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
718 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
719 call assert_equal(3, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
720
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
721 " jump to the newer tag
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
722 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
723 ptag
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
724 wincmd P
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
725 call assert_equal(3, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
726
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
727 " close the preview window
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
728 pclose
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
729 call assert_equal(1, winnr('$'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
730
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
731 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
732 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
733
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
734 " Tests for guessing the tag location
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
735 func Test_tag_guess()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
736 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
737 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
738
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
739 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
740 \ "func1\tXfoo\t/^int func1(int x)/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
741 \ "func2\tXfoo\t/^int func2(int y)/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
742 \ "func3\tXfoo\t/^func3/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
743 \ "func4\tXfoo\t/^func4/"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
744 \ 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
745 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
746 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
747
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
748 int FUNC1 (int x) { }
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
749 int
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
750 func2 (int y) { }
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
751 int * func3 () { }
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
752
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
753 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
754 call writefile(code, 'Xfoo', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
755
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
756 let v:statusmsg = ''
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
757 ta func1
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
758 call assert_match('E435:', v:statusmsg)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
759 call assert_equal(2, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
760 let v:statusmsg = ''
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
761 ta func2
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
762 call assert_match('E435:', v:statusmsg)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
763 call assert_equal(4, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
764 let v:statusmsg = ''
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
765 ta func3
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
766 call assert_match('E435:', v:statusmsg)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
767 call assert_equal(5, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
768 call assert_fails('ta func4', 'E434:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
769
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
770 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
771 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
772
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
773 " Test for an unsorted tags file
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
774 func Test_tag_sort()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
775 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
776 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
777
28027
d59552ad3f36 patch 8.2.4538: the find_tags_in_file() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 27986
diff changeset
778 let l = [
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
779 \ "first\tXfoo\t1",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
780 \ "ten\tXfoo\t3",
28027
d59552ad3f36 patch 8.2.4538: the find_tags_in_file() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 27986
diff changeset
781 \ "six\tXfoo\t2"]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
782 call writefile(l, 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
783 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
784 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
785 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
786 int six() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
787 int ten() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
788 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
789 call writefile(code, 'Xfoo', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
790
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
791 call assert_fails('tag first', 'E432:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
792
28027
d59552ad3f36 patch 8.2.4538: the find_tags_in_file() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 27986
diff changeset
793 " When multiple tag files are not sorted, then message should be displayed
d59552ad3f36 patch 8.2.4538: the find_tags_in_file() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 27986
diff changeset
794 " multiple times
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
795 call writefile(l, 'Xtags2', 'D')
28027
d59552ad3f36 patch 8.2.4538: the find_tags_in_file() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 27986
diff changeset
796 set tags=Xtags,Xtags2
d59552ad3f36 patch 8.2.4538: the find_tags_in_file() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 27986
diff changeset
797 call assert_fails('tag first', ['E432:', 'E432:'])
d59552ad3f36 patch 8.2.4538: the find_tags_in_file() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 27986
diff changeset
798
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
799 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
800 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
801 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
802
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
803 " Test for an unsorted tags file
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
804 func Test_tag_fold()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
805 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
806 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
807
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
808 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
809 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
810 \ "!_TAG_FILE_SORTED\t2\t/0=unsorted, 1=sorted, 2=foldcase/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
811 \ "first\tXfoo\t1",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
812 \ "second\tXfoo\t2",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
813 \ "third\tXfoo\t3"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
814 \ 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
815 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
816 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
817 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
818 int second() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
819 int third() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
820 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
821 call writefile(code, 'Xfoo', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
822
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
823 enew
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
824 tag second
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
825 call assert_equal('Xfoo', bufname(''))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
826 call assert_equal(2, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
827
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
828 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
829 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
830 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
831
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
832 " Test for the :ltag command
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
833 func Test_ltag()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
834 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
835 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
836
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
837 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
838 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
839 \ "first\tXfoo\t1",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
840 \ "second\tXfoo\t/^int second() {}$/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
841 \ "third\tXfoo\t3"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
842 \ 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
843 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
844 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
845 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
846 int second() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
847 int third() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
848 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
849 call writefile(code, 'Xfoo', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
850
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
851 enew
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
852 call setloclist(0, [], 'f')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
853 ltag third
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
854 call assert_equal('Xfoo', bufname(''))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
855 call assert_equal(3, line('.'))
24964
f4aa891a5ab8 patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
856 call assert_equal([{'lnum': 3, 'end_lnum': 0, 'bufnr': bufnr('Xfoo'),
f4aa891a5ab8 patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
857 \ 'col': 0, 'end_col': 0, 'pattern': '', 'valid': 1, 'vcol': 0,
f4aa891a5ab8 patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
858 \ 'nr': 0, 'type': '', 'module': '', 'text': 'third'}], getloclist(0))
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
859
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
860 ltag second
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
861 call assert_equal(2, line('.'))
24964
f4aa891a5ab8 patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
862 call assert_equal([{'lnum': 0, 'end_lnum': 0, 'bufnr': bufnr('Xfoo'),
f4aa891a5ab8 patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
863 \ 'col': 0, 'end_col': 0, 'pattern': '^\Vint second() {}\$',
f4aa891a5ab8 patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
864 \ 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '', 'module': '',
f4aa891a5ab8 patch 8.2.3019: location list only has the start position.
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
865 \ 'text': 'second'}], getloclist(0))
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
866
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
867 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
868 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
869 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
870
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
871 " Test for setting the last search pattern to the tag search pattern
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
872 " when cpoptions has 't'
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
873 func Test_tag_last_search_pat()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
874 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
875 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
876
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
877 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
878 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
879 \ "first\tXfoo\t/^int first() {}/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
880 \ "second\tXfoo\t/^int second() {}/",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
881 \ "third\tXfoo\t/^int third() {}/"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
882 \ 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
883 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
884 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
885 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
886 int second() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
887 int third() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
888 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
889 call writefile(code, 'Xfoo', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
890
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
891 enew
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
892 let save_cpo = &cpo
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
893 set cpo+=t
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
894 let @/ = ''
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
895 tag second
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
896 call assert_equal('^int second() {}', @/)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
897 let &cpo = save_cpo
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
898
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
899 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
900 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
901 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
902
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
903 " Tag stack tests
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
904 func Test_tag_stack()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
905 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
906 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
907
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
908 let l = []
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
909 for i in range(10, 31)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
910 let l += ["var" .. i .. "\tXfoo\t/^int var" .. i .. ";$/"]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
911 endfor
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
912 call writefile(l, 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
913 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
914
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
915 let l = []
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
916 for i in range(10, 31)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
917 let l += ["int var" .. i .. ";"]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
918 endfor
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
919 call writefile(l, 'Xfoo', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
920
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
921 " Jump to a tag when the tag stack is full. Oldest entry should be removed.
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
922 enew
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
923 for i in range(10, 30)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
924 exe "tag var" .. i
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
925 endfor
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
926 let l = gettagstack()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
927 call assert_equal(20, l.length)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
928 call assert_equal('var11', l.items[0].tagname)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
929 tag var31
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
930 let l = gettagstack()
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
931 call assert_equal('var12', l.items[0].tagname)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
932 call assert_equal('var31', l.items[19].tagname)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
933
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
934 " Use tnext with a single match
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
935 call assert_fails('tnext', 'E427:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
936
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
937 " Jump to newest entry from the top of the stack
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
938 call assert_fails('tag', 'E556:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
939
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
940 " Pop with zero count from the top of the stack
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
941 call assert_fails('0pop', 'E556:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
942
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
943 " Pop from an unsaved buffer
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
944 enew!
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
945 call append(1, "sample text")
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
946 call assert_fails('pop', 'E37:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
947 call assert_equal(21, gettagstack().curidx)
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
948 enew!
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
949
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
950 " Pop all the entries in the tag stack
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
951 call assert_fails('30pop', 'E555:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
952
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
953 " Pop with a count when already at the bottom of the stack
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
954 call assert_fails('exe "normal 4\<C-T>"', 'E555:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
955 call assert_equal(1, gettagstack().curidx)
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
956
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
957 " Jump to newest entry from the bottom of the stack with zero count
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
958 call assert_fails('0tag', 'E555:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
959
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
960 " Pop the tag stack when it is empty
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
961 call settagstack(1, {'items' : []})
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
962 call assert_fails('pop', 'E73:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
963
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
964 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
965 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
966 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
967
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
968 " Test for browsing multiple matching tags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
969 func Test_tag_multimatch()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
970 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
971 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
972
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
973 call writefile([
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
974 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
975 \ "first\tXfoo\t1",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
976 \ "first\tXfoo\t2",
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
977 \ "first\tXfoo\t3"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
978 \ 'Xtags', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
979 set tags=Xtags
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
980 let code =<< trim [CODE]
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
981 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
982 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
983 int first() {}
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
984 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
985 call writefile(code, 'Xfoo', 'D')
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
986
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
987 call settagstack(1, {'items' : []})
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
988 tag first
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
989 tlast
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
990 call assert_equal(3, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
991 call assert_fails('tnext', 'E428:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
992 tfirst
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
993 call assert_equal(1, line('.'))
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
994 call assert_fails('tprev', 'E425:')
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
995
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
996 tlast
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
997 call feedkeys("5\<CR>", 't')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
998 tselect first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
999 call assert_equal(2, gettagstack().curidx)
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1000
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1001 set ignorecase
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1002 tag FIRST
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1003 tnext
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1004 call assert_equal(2, line('.'))
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1005 tlast
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1006 tprev
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1007 call assert_equal(2, line('.'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1008 tNext
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1009 call assert_equal(1, line('.'))
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1010 set ignorecase&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1011
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1012 set tags&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1013 %bwipe
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1014 endfunc
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1015
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1016 " Test for previewing multiple matching tags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1017 func Test_preview_tag_multimatch()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1018 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1019 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1020
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1021 call writefile([
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1022 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1023 \ "first\tXfoo\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1024 \ "first\tXfoo\t2",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1025 \ "first\tXfoo\t3"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1026 \ 'Xtags', 'D')
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1027 set tags=Xtags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1028 let code =<< trim [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1029 int first() {}
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1030 int first() {}
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1031 int first() {}
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1032 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1033 call writefile(code, 'Xfoo', 'D')
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1034
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1035 enew | only
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1036 ptag first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1037 ptlast
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1038 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1039 call assert_equal(3, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1040 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1041 call assert_fails('ptnext', 'E428:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1042 ptprev
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1043 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1044 call assert_equal(2, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1045 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1046 ptfirst
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1047 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1048 call assert_equal(1, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1049 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1050 call assert_fails('ptprev', 'E425:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1051 ptnext
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1052 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1053 call assert_equal(2, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1054 wincmd w
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1055 ptlast
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1056 call feedkeys("5\<CR>", 't')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1057 ptselect first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1058 wincmd P
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1059 call assert_equal(3, line('.'))
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1060
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1061 pclose
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1062
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1063 set tags&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1064 %bwipe
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1065 endfunc
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1066
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1067 " Test for jumping to multiple matching tags across multiple :tags commands
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1068 func Test_tnext_multimatch()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1069 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1070 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1071
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1072 call writefile([
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1073 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1074 \ "first\tXfoo1\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1075 \ "first\tXfoo2\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1076 \ "first\tXfoo3\t1"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1077 \ 'Xtags', 'D')
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1078 set tags=Xtags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1079 let code =<< trim [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1080 int first() {}
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1081 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1082 call writefile(code, 'Xfoo1', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1083 call writefile(code, 'Xfoo2', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1084 call writefile(code, 'Xfoo3', 'D')
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1085
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1086 tag first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1087 tag first
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1088 pop
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1089 tnext
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1090 tnext
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1091 call assert_fails('tnext', 'E428:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1092
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1093 set tags&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1094 %bwipe
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1095 endfunc
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1096
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1097 " Test for jumping to multiple matching tags in non-existing files
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1098 func Test_multimatch_non_existing_files()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1099 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1100 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1101
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1102 call writefile([
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1103 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1104 \ "first\tXfoo1\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1105 \ "first\tXfoo2\t1",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1106 \ "first\tXfoo3\t1"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1107 \ 'Xtags', 'D')
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1108 set tags=Xtags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1109
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1110 call settagstack(1, {'items' : []})
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1111 call assert_fails('tag first', 'E429:')
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1112 call assert_equal(3, gettagstack().items[0].matchnr)
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1113
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1114 set tags&
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1115 %bwipe
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1116 endfunc
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1117
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1118 func Test_tselect_listing()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1119 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1120 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1121
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1122 call writefile([
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1123 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1124 \ "first\tXfoo\t1" .. ';"' .. "\tv\ttyperef:typename:int\tfile:",
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1125 \ "first\tXfoo\t2" .. ';"' .. "\tkind:v\ttyperef:typename:char\tfile:"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1126 \ 'Xtags', 'D')
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1127 set tags=Xtags
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1128
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1129 let code =<< trim [CODE]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1130 static int first;
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1131 static char first;
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1132 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1133 call writefile(code, 'Xfoo', 'D')
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1134
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1135 call feedkeys("\<CR>", "t")
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1136 let l = split(execute("tselect first"), "\n")
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1137 let expected =<< [DATA]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1138 # pri kind tag file
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1139 1 FS v first Xfoo
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1140 typeref:typename:int
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1141 1
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1142 2 FS v first Xfoo
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1143 typeref:typename:char
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1144 2
20796
8b775cd23555 patch 8.2.0950: tagjump test fails
Bram Moolenaar <Bram@vim.org>
parents: 20120
diff changeset
1145 Type number and <Enter> (q or empty cancels):
19063
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1146 [DATA]
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1147 call assert_equal(expected, l)
fdc8deab9b4c patch 8.2.0092: tags functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19055
diff changeset
1148
19055
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1149 set tags&
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1150 %bwipe
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1151 endfunc
8645b73b3645 patch 8.2.0088: insufficient tests for tags; bug in using extra tag field
Bram Moolenaar <Bram@vim.org>
parents: 19033
diff changeset
1152
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1153 " Test for :isearch, :ilist, :ijump and :isplit commands
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1154 " Test for [i, ]i, [I, ]I, [ CTRL-I, ] CTRL-I and CTRL-W i commands
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1155 func Test_inc_search()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1156 new
22476
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1157 call setline(1, ['1:foo', '2:foo', 'foo', '3:foo', '4:foo', '==='])
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1158 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1159
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1160 " Test for [i and ]i
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1161 call assert_equal('1:foo', execute('normal [i'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1162 call assert_equal('2:foo', execute('normal 2[i'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1163 call assert_fails('normal 3[i', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1164 call assert_equal('3:foo', execute('normal ]i'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1165 call assert_equal('4:foo', execute('normal 2]i'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1166 call assert_fails('normal 3]i', 'E389:')
22476
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1167 call assert_fails('normal G]i', 'E349:')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1168 call assert_fails('normal [i', 'E349:')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1169 call cursor(3, 1)
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1170
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1171 " Test for :isearch
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1172 call assert_equal('1:foo', execute('isearch foo'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1173 call assert_equal('3:foo', execute('isearch 4 /foo/'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1174 call assert_fails('isearch 3 foo', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1175 call assert_equal('3:foo', execute('+1,$isearch foo'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1176 call assert_fails('1,.-1isearch 3 foo', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1177 call assert_fails('isearch bar', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1178 call assert_fails('isearch /foo/3', 'E488:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1179
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1180 " Test for [I and ]I
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1181 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1182 \ ' 1: 1 1:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1183 \ ' 2: 2 2:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1184 \ ' 3: 3 foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1185 \ ' 4: 4 3:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1186 \ ' 5: 5 4:foo'], split(execute('normal [I'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1187 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1188 \ ' 1: 4 3:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1189 \ ' 2: 5 4:foo'], split(execute('normal ]I'), "\n"))
22476
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1190 call assert_fails('normal G]I', 'E349:')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1191 call assert_fails('normal [I', 'E349:')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1192 call cursor(3, 1)
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1193
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1194 " Test for :ilist
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1195 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1196 \ ' 1: 1 1:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1197 \ ' 2: 2 2:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1198 \ ' 3: 3 foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1199 \ ' 4: 4 3:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1200 \ ' 5: 5 4:foo'], split(execute('ilist foo'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1201 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1202 \ ' 1: 4 3:foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1203 \ ' 2: 5 4:foo'], split(execute('+1,$ilist /foo/'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1204 call assert_fails('ilist bar', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1205
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1206 " Test for [ CTRL-I and ] CTRL-I
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1207 exe "normal [\t"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1208 call assert_equal([1, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1209 exe "normal 2j4[\t"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1210 call assert_equal([4, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1211 call assert_fails("normal k3[\t", 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1212 call assert_fails("normal 6[\t", 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1213 exe "normal ]\t"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1214 call assert_equal([4, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1215 exe "normal k2]\t"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1216 call assert_equal([5, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1217 call assert_fails("normal 2k3]\t", 'E389:')
22476
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1218 call assert_fails("normal G[\t", 'E349:')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1219 call assert_fails("normal ]\t", 'E349:')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1220 call cursor(3, 1)
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1221
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1222 " Test for :ijump
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1223 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1224 ijump foo
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1225 call assert_equal([1, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1226 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1227 ijump 4 /foo/
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1228 call assert_equal([4, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1229 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1230 call assert_fails('ijump 3 foo', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1231 +,$ijump 2 foo
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1232 call assert_equal([5, 3], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1233 call assert_fails('ijump bar', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1234
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1235 " Test for CTRL-W i
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1236 call cursor(3, 1)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1237 wincmd i
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1238 call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1239 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1240 5wincmd i
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1241 call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1242 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1243 call assert_fails('3wincmd i', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1244 call assert_fails('6wincmd i', 'E389:')
22476
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1245 call assert_fails("normal G\<C-W>i", 'E349:')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
1246 call cursor(3, 1)
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1247
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1248 " Test for :isplit
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1249 isplit foo
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1250 call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1251 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1252 isplit 5 /foo/
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1253 call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1254 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1255 call assert_fails('isplit 3 foo', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1256 call assert_fails('isplit 6 foo', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1257 call assert_fails('isplit bar', 'E389:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1258
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1259 close!
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1260 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1261
29056
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1262 " this was using a line from ml_get() freed by the regexp
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1263 func Test_isearch_copy_line()
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1264 new
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1265 norm o
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1266 norm 0
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1267 0norm o
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1268 sil! norm bc0
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1269 sil! isearch \%')
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1270 bwipe!
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1271 endfunc
485619e7f836 patch 8.2.5050: using freed memory when searching for pattern in path
Bram Moolenaar <Bram@vim.org>
parents: 29004
diff changeset
1272
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1273 " Test for :dsearch, :dlist, :djump and :dsplit commands
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1274 " Test for [d, ]d, [D, ]D, [ CTRL-D, ] CTRL-D and CTRL-W d commands
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1275 func Test_macro_search()
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1276 new
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1277 call setline(1, ['#define FOO 1', '#define FOO 2', '#define FOO 3',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1278 \ '#define FOO 4', '#define FOO 5'])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1279 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1280
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1281 " Test for [d and ]d
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1282 call assert_equal('#define FOO 1', execute('normal [d'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1283 call assert_equal('#define FOO 2', execute('normal 2[d'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1284 call assert_fails('normal 3[d', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1285 call assert_equal('#define FOO 4', execute('normal ]d'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1286 call assert_equal('#define FOO 5', execute('normal 2]d'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1287 call assert_fails('normal 3]d', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1288
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1289 " Test for :dsearch
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1290 call assert_equal('#define FOO 1', execute('dsearch FOO'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1291 call assert_equal('#define FOO 5', execute('dsearch 5 /FOO/'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1292 call assert_fails('dsearch 3 FOO', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1293 call assert_equal('#define FOO 4', execute('+1,$dsearch FOO'))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1294 call assert_fails('1,.-1dsearch 3 FOO', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1295 call assert_fails('dsearch BAR', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1296
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1297 " Test for [D and ]D
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1298 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1299 \ ' 1: 1 #define FOO 1',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1300 \ ' 2: 2 #define FOO 2',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1301 \ ' 3: 3 #define FOO 3',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1302 \ ' 4: 4 #define FOO 4',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1303 \ ' 5: 5 #define FOO 5'], split(execute('normal [D'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1304 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1305 \ ' 1: 4 #define FOO 4',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1306 \ ' 2: 5 #define FOO 5'], split(execute('normal ]D'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1307
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1308 " Test for :dlist
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1309 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1310 \ ' 1: 1 #define FOO 1',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1311 \ ' 2: 2 #define FOO 2',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1312 \ ' 3: 3 #define FOO 3',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1313 \ ' 4: 4 #define FOO 4',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1314 \ ' 5: 5 #define FOO 5'], split(execute('dlist FOO'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1315 call assert_equal([
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1316 \ ' 1: 4 #define FOO 4',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1317 \ ' 2: 5 #define FOO 5'], split(execute('+1,$dlist /FOO/'), "\n"))
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1318 call assert_fails('dlist BAR', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1319
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1320 " Test for [ CTRL-D and ] CTRL-D
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1321 exe "normal [\<C-D>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1322 call assert_equal([1, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1323 exe "normal 2j4[\<C-D>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1324 call assert_equal([4, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1325 call assert_fails("normal k3[\<C-D>", 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1326 call assert_fails("normal 6[\<C-D>", 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1327 exe "normal ]\<C-D>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1328 call assert_equal([4, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1329 exe "normal k2]\<C-D>"
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1330 call assert_equal([5, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1331 call assert_fails("normal 2k3]\<C-D>", 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1332
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1333 " Test for :djump
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1334 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1335 djump FOO
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1336 call assert_equal([1, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1337 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1338 djump 4 /FOO/
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1339 call assert_equal([4, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1340 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1341 call assert_fails('djump 3 FOO', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1342 +,$djump 2 FOO
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1343 call assert_equal([5, 9], [line('.'), col('.')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1344 call assert_fails('djump BAR', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1345
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1346 " Test for CTRL-W d
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1347 call cursor(3, 9)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1348 wincmd d
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1349 call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1350 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1351 5wincmd d
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1352 call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1353 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1354 call assert_fails('3wincmd d', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1355 call assert_fails('6wincmd d', 'E388:')
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
1356 new
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
1357 call assert_fails("normal \<C-W>d", 'E349:')
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
1358 call assert_fails("normal \<C-W>\<C-D>", 'E349:')
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
1359 close
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1360
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1361 " Test for :dsplit
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1362 dsplit FOO
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1363 call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1364 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1365 dsplit 5 /FOO/
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1366 call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1367 close
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1368 call assert_fails('dsplit 3 FOO', 'E387:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1369 call assert_fails('dsplit 6 FOO', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1370 call assert_fails('dsplit BAR', 'E388:')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1371
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1372 close!
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1373 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19063
diff changeset
1374
28913
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1375 func Test_define_search()
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1376 " this was accessing freed memory
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1377 new
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1378 call setline(1, ['first line', '', '#define something 0'])
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1379 sil norm o0
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1380 sil! norm 
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1381 bwipe!
29004
c7e3721ec88f patch 8.2.5024: using freed memory with "]d"
Bram Moolenaar <Bram@vim.org>
parents: 28913
diff changeset
1382
c7e3721ec88f patch 8.2.5024: using freed memory with "]d"
Bram Moolenaar <Bram@vim.org>
parents: 28913
diff changeset
1383 new somefile
c7e3721ec88f patch 8.2.5024: using freed memory with "]d"
Bram Moolenaar <Bram@vim.org>
parents: 28913
diff changeset
1384 call setline(1, ['first line', '', '#define something 0'])
c7e3721ec88f patch 8.2.5024: using freed memory with "]d"
Bram Moolenaar <Bram@vim.org>
parents: 28913
diff changeset
1385 sil norm 0o0
c7e3721ec88f patch 8.2.5024: using freed memory with "]d"
Bram Moolenaar <Bram@vim.org>
parents: 28913
diff changeset
1386 sil! norm ]d
c7e3721ec88f patch 8.2.5024: using freed memory with "]d"
Bram Moolenaar <Bram@vim.org>
parents: 28913
diff changeset
1387 bwipe!
28913
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1388 endfunc
22f743798f84 patch 8.2.4979: accessing freed memory when line is flushed
Bram Moolenaar <Bram@vim.org>
parents: 28037
diff changeset
1389
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1390 " Test for [*, [/, ]* and ]/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1391 func Test_comment_search()
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1392 new
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1393 call setline(1, ['', '/*', ' *', ' *', ' */'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1394 normal! 4gg[/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1395 call assert_equal([2, 1], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1396 normal! 3gg[*
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1397 call assert_equal([2, 1], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1398 normal! 3gg]/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1399 call assert_equal([5, 3], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1400 normal! 3gg]*
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1401 call assert_equal([5, 3], [line('.'), col('.')])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1402 %d
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1403 call setline(1, ['', '/*', ' *', ' *'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1404 call assert_beeps('normal! 3gg]/')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1405 %d
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1406 call setline(1, ['', ' *', ' *', ' */'])
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1407 call assert_beeps('normal! 4gg[/')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1408 %d
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1409 call setline(1, ' /* comment */')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1410 normal! 15|[/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1411 call assert_equal(9, col('.'))
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1412 normal! 15|]/
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1413 call assert_equal(21, col('.'))
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1414 call setline(1, ' comment */')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1415 call assert_beeps('normal! 15|[/')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1416 call setline(1, ' /* comment')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1417 call assert_beeps('normal! 15|]/')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1418 close!
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1419 endfunc
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
1420
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1421 " Test for the 'taglength' option
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1422 func Test_tag_length()
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1423 set tags=Xtags
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1424 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
1425 \ "tame\tXtlfile1\t1;",
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1426 \ "tape\tXtlfile2\t1;"], 'Xtags', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1427 call writefile(['tame'], 'Xtlfile1', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1428 call writefile(['tape'], 'Xtlfile2', 'D')
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1429
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1430 " Jumping to the tag 'tape', should instead jump to 'tame'
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1431 new
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1432 set taglength=2
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1433 tag tape
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
1434 call assert_equal('Xtlfile1', @%)
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1435 " Tag search should jump to the right tag
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1436 enew
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1437 tag /^tape$
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
1438 call assert_equal('Xtlfile2', @%)
20893
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1439
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1440 set tags& taglength&
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1441 endfunc
c78689fa0633 patch 8.2.0998: not all tag code is tested
Bram Moolenaar <Bram@vim.org>
parents: 20796
diff changeset
1442
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1443 " Tests for errors in a tags file
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1444 func Test_tagfile_errors()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1445 set tags=Xtags
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1446
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1447 " missing search pattern or line number for a tag
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1448 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1449 \ "foo\tXfile\t"], 'Xtags', 'bD')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1450 call writefile(['foo'], 'Xfile', 'D')
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1451
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1452 enew
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1453 tag foo
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1454 call assert_equal('', @%)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1455 let caught_431 = v:false
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1456 try
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1457 eval taglist('.*')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1458 catch /:E431:/
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1459 let caught_431 = v:true
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1460 endtry
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1461 call assert_equal(v:true, caught_431)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1462
27938
b65a50d2fa4f patch 8.2.4494: the find_tags() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 25652
diff changeset
1463 " tag name and file name are not separated by a tab
b65a50d2fa4f patch 8.2.4494: the find_tags() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 25652
diff changeset
1464 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
b65a50d2fa4f patch 8.2.4494: the find_tags() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 25652
diff changeset
1465 \ "foo Xfile 1"], 'Xtags')
b65a50d2fa4f patch 8.2.4494: the find_tags() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 25652
diff changeset
1466 call assert_fails('tag foo', 'E431:')
b65a50d2fa4f patch 8.2.4494: the find_tags() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 25652
diff changeset
1467
27974
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
1468 " file name and search pattern are not separated by a tab
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
1469 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
1470 \ "foo\tXfile 1;"], 'Xtags')
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
1471 call assert_fails('tag foo', 'E431:')
495418c6cac8 patch 8.2.4512: the find_tags_in_file() function is much too long
Bram Moolenaar <Bram@vim.org>
parents: 27938
diff changeset
1472
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1473 set tags&
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1474 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1475
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1476 " When :stag fails to open the file, should close the new window
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1477 func Test_stag_close_window_on_error()
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1478 new | only
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1479 set tags=Xtags
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1480 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1481 \ "foo\tXfile\t1"], 'Xtags', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1482 call writefile(['foo'], 'Xfile', 'D')
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1483 call writefile([], '.Xfile.swp', 'D')
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1484 " Remove the catch-all that runtest.vim adds
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1485 au! SwapExists
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1486 augroup StagTest
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1487 au!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1488 autocmd SwapExists Xfile let v:swapchoice='q'
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1489 augroup END
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1490
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1491 stag foo
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1492 call assert_equal(1, winnr('$'))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1493 call assert_equal('', @%)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1494
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1495 augroup StagTest
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1496 au!
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1497 augroup END
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1498 set tags&
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1499 endfunc
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20893
diff changeset
1500
27986
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1501 " Test for 'tagbsearch' (binary search)
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1502 func Test_tagbsearch()
31343
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1503 " in case a previous failure left a swap file behind
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1504 call delete('.Xfoo.swp')
97bb0811cfd4 patch 9.0.1005: a failed test may leave a swap file behind
Bram Moolenaar <Bram@vim.org>
parents: 30865
diff changeset
1505
27986
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1506 " If a tags file header says the tags are sorted, but the tags are actually
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1507 " unsorted, then binary search should fail and linear search should work.
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1508 call writefile([
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1509 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1510 \ "!_TAG_FILE_SORTED\t1\t/0=unsorted, 1=sorted, 2=foldcase/",
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1511 \ "third\tXfoo\t3",
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1512 \ "second\tXfoo\t2",
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1513 \ "first\tXfoo\t1"],
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1514 \ 'Xtags', 'D')
27986
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1515 set tags=Xtags
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1516 let code =<< trim [CODE]
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1517 int first() {}
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1518 int second() {}
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1519 int third() {}
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1520 [CODE]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
1521 call writefile(code, 'Xfoo', 'D')
27986
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1522
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1523 enew
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1524 set tagbsearch
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1525 call assert_fails('tag first', 'E426:')
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1526 call assert_equal('', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1527 call assert_fails('tag second', 'E426:')
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1528 call assert_equal('', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1529 tag third
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1530 call assert_equal('Xfoo', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1531 call assert_equal(3, line('.'))
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1532 %bw!
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1533
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1534 set notagbsearch
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1535 tag first
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1536 call assert_equal('Xfoo', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1537 call assert_equal(1, line('.'))
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1538 enew
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1539 tag second
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1540 call assert_equal('Xfoo', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1541 call assert_equal(2, line('.'))
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1542 enew
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1543 tag third
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1544 call assert_equal('Xfoo', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1545 call assert_equal(3, line('.'))
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1546 %bw!
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1547
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1548 " If a tags file header says the tags are unsorted, but the tags are
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1549 " actually sorted, then binary search should work.
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1550 call writefile([
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1551 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1552 \ "!_TAG_FILE_SORTED\t0\t/0=unsorted, 1=sorted, 2=foldcase/",
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1553 \ "first\tXfoo\t1",
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1554 \ "second\tXfoo\t2",
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1555 \ "third\tXfoo\t3"],
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1556 \ 'Xtags')
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1557
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1558 set tagbsearch
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1559 tag first
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1560 call assert_equal('Xfoo', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1561 call assert_equal(1, line('.'))
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1562 enew
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1563 tag second
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1564 call assert_equal('Xfoo', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1565 call assert_equal(2, line('.'))
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1566 enew
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1567 tag third
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1568 call assert_equal('Xfoo', bufname())
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1569 call assert_equal(3, line('.'))
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1570 %bw!
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1571
28037
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1572 " Binary search fails on EOF
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1573 call writefile([
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1574 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1575 \ "!_TAG_FILE_SORTED\t1\t/0=unsorted, 1=sorted, 2=foldcase/",
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1576 \ "bar\tXfoo\t1",
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1577 \ "foo\tXfoo\t2"],
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1578 \ 'Xtags')
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1579 call assert_fails('tag bbb', 'E426:')
12a256140887 patch 8.2.4543: Coverity warning for refactored tag search code
Bram Moolenaar <Bram@vim.org>
parents: 28027
diff changeset
1580
27986
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1581 set tags& tagbsearch&
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1582 endfunc
c724906134a3 patch 8.2.4518: the binary tag search feature is always enabled
Bram Moolenaar <Bram@vim.org>
parents: 27974
diff changeset
1583
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
1584 " vim: shiftwidth=2 sts=2 expandtab