blob: ddd4de0b89c8c129834046a878a2ca8984b6b85d [file] [log] [blame]
Bram Moolenaar6d20e172016-07-13 22:44:12 +02001" Test for cscope commands.
2
Bram Moolenaarb46fecd2019-06-15 17:58:09 +02003CheckFeature cscope
4CheckFeature quickfix
Bram Moolenaar8c5a2782019-08-07 23:07:07 +02005CheckExecutable cscope
Bram Moolenaar6d20e172016-07-13 22:44:12 +02006
Bram Moolenaar812ad4f2016-08-07 14:03:13 +02007func CscopeSetupOrClean(setup)
8 if a:setup
9 noa sp ../memfile_test.c
10 saveas! Xmemfile_test.c
11 call system('cscope -bk -fXcscope.out Xmemfile_test.c')
12 call system('cscope -bk -fXcscope2.out Xmemfile_test.c')
13 cscope add Xcscope.out
14 set cscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-,a-
15 else
16 cscope kill -1
17 for file in ['Xcscope.out', 'Xcscope2.out', 'Xmemfile_test.c']
18 call delete(file)
19 endfo
20 endif
21endfunc
22
23func Test_cscopeWithCscopeConnections()
24 call CscopeSetupOrClean(1)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020025 " Test: E568: duplicate cscope database not added
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020026 try
27 set nocscopeverbose
28 cscope add Xcscope.out
29 set cscopeverbose
30 catch
Bram Moolenaar37175402017-03-18 20:18:45 +010031 call assert_report('exception thrown')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020032 endtry
Bram Moolenaare2e40752020-09-04 21:18:46 +020033 call assert_fails('cscope add', 'E560:')
34 call assert_fails('cscope add Xcscope.out', 'E568:')
35 call assert_fails('cscope add doesnotexist.out', 'E563:')
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020036 if has('unix')
37 call assert_fails('cscope add /dev/null', 'E564:')
38 endif
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020039
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020040 " Test: Find this C-Symbol
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020041 for cmd in ['cs find s main', 'cs find 0 main']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020042 let a = execute(cmd)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020043 " Test where it moves the cursor
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020044 call assert_equal('main(void)', getline('.'))
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020045 " Test the output of the :cs command
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020046 call assert_match('\n(1 of 1): <<main>> main(void )', a)
47 endfor
48
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020049 " Test: Find this definition
50 for cmd in ['cs find g test_mf_hash',
51 \ 'cs find 1 test_mf_hash',
52 \ 'cs find 1 test_mf_hash'] " leading space ignored.
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020053 exe cmd
54 call assert_equal(['', '/*', ' * Test mf_hash_*() functions.', ' */', ' static void', 'test_mf_hash(void)', '{'], getline(line('.')-5, line('.')+1))
55 endfor
56
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020057 " Test: Find functions called by this function
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020058 for cmd in ['cs find d test_mf_hash', 'cs find 2 test_mf_hash']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020059 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020060 call assert_match('\n(1 of 42): <<mf_hash_init>> mf_hash_init(&ht);', a)
61 call assert_equal(' mf_hash_init(&ht);', getline('.'))
62 endfor
63
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020064 " Test: Find functions calling this function
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020065 for cmd in ['cs find c test_mf_hash', 'cs find 3 test_mf_hash']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020066 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020067 call assert_match('\n(1 of 1): <<main>> test_mf_hash();', a)
68 call assert_equal(' test_mf_hash();', getline('.'))
69 endfor
70
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020071 " Test: Find this text string
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020072 for cmd in ['cs find t Bram', 'cs find 4 Bram']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020073 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020074 call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
75 call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
76 endfor
77
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020078 " Test: Find this egrep pattern
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020079 " test all matches returned by cscope
80 for cmd in ['cs find e ^\#includ.', 'cs find 6 ^\#includ.']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020081 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020082 call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
83 call assert_equal('#include <assert.h>', getline('.'))
84 cnext
85 call assert_equal('#include "main.c"', getline('.'))
86 cnext
87 call assert_equal('#include "memfile.c"', getline('.'))
88 call assert_fails('cnext', 'E553:')
89 endfor
90
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020091 " Test: Find the same egrep pattern using lcscope this time.
Bram Moolenaar259f26a2018-05-15 22:25:40 +020092 let a = execute('lcs find e ^\#includ.')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020093 call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
94 call assert_equal('#include <assert.h>', getline('.'))
95 lnext
96 call assert_equal('#include "main.c"', getline('.'))
97 lnext
98 call assert_equal('#include "memfile.c"', getline('.'))
99 call assert_fails('lnext', 'E553:')
100
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200101 " Test: Find this file
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200102 for cmd in ['cs find f Xmemfile_test.c', 'cs find 7 Xmemfile_test.c']
103 enew
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200104 let a = execute(cmd)
Bram Moolenaar3f40ce72020-07-05 14:10:13 +0200105 call assert_true(a =~ '"Xmemfile_test.c" \d\+L, \d\+B')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200106 call assert_equal('Xmemfile_test.c', @%)
107 endfor
108
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200109 " Test: Find files #including this file
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200110 for cmd in ['cs find i assert.h', 'cs find 8 assert.h']
111 enew
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200112 let a = execute(cmd)
Bram Moolenaar47922552016-08-30 10:56:50 +0200113 let alines = split(a, '\n', 1)
114 call assert_equal('', alines[0])
Bram Moolenaar3f40ce72020-07-05 14:10:13 +0200115 call assert_true(alines[1] =~ '"Xmemfile_test.c" \d\+L, \d\+B')
Bram Moolenaar47922552016-08-30 10:56:50 +0200116 call assert_equal('(1 of 1): <<global>> #include <assert.h>', alines[2])
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200117 call assert_equal('#include <assert.h>', getline('.'))
118 endfor
119
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200120 " Test: Invalid find command
Dominique Pelle1e469c72021-05-24 19:37:26 +0200121 call assert_fails('cs find', 'E560:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200122 call assert_fails('cs find x', 'E560:')
123
Bram Moolenaar73e28dc2022-09-17 21:08:33 +0100124 " Test: Find places where this symbol is assigned a value
125 " this needs a cscope >= 15.8
126 " unfortunately, Travis has cscope version 15.7
127 let cscope_version = systemlist('cscope --version')[0]
128 let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?'))
129 if cs_version >= 15.8
130 for cmd in ['cs find a item', 'cs find 9 item']
131 let a = execute(cmd)
132 call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = LALLOC_CLEAR_ONE(mf_hashitem_T);'], split(a, '\n', 1))
133 call assert_equal(' item = LALLOC_CLEAR_ONE(mf_hashitem_T);', getline('.'))
134 cnext
135 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
136 cnext
137 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
138 cnext
139 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
140 endfor
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200141 endif
142
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200143 " Test: leading whitespace is not removed for cscope find text
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200144 let a = execute('cscope find t test_mf_hash')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200145 call assert_equal(['', '(1 of 1): <<<unknown>>> test_mf_hash();'], split(a, '\n', 1))
146 call assert_equal(' test_mf_hash();', getline('.'))
147
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200148 " Test: test with scscope
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200149 let a = execute('scs find t Bram')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200150 call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
151 call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
152
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200153 " Test: cscope help
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200154 for cmd in ['cs', 'cs help', 'cs xxx']
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200155 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200156 call assert_match('^cscope commands:\n', a)
157 call assert_match('\nadd :', a)
158 call assert_match('\nfind :', a)
159 call assert_match('\nhelp : Show this message', a)
160 call assert_match('\nkill : Kill a connection', a)
161 call assert_match('\nreset: Reinit all connections', a)
162 call assert_match('\nshow : Show connections', a)
163 endfor
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200164 let a = execute('scscope help')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200165 call assert_match('This cscope command does not support splitting the window\.', a)
166
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200167 " Test: reset connections
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200168 let a = execute('cscope reset')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200169 call assert_match('\nAdded cscope database.*Xcscope.out (#0)', a)
170 call assert_match('\nAll cscope databases reset', a)
171
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200172 " Test: cscope show
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200173 let a = execute('cscope show')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200174 call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
175
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200176 " Test: cstag and 'csto' option
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200177 set csto=0
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200178 let a = execute('cstag TEST_COUNT')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200179 call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
180 call assert_equal('#define TEST_COUNT 50000', getline('.'))
Dominique Pelle1e469c72021-05-24 19:37:26 +0200181 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200182 set csto=1
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200183 let a = execute('cstag index_to_key')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200184 call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
185 call assert_equal('#define index_to_key(i) ((i) ^ 15167)', getline('.'))
Dominique Pelle1e469c72021-05-24 19:37:26 +0200186 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200187 call assert_fails('cstag', 'E562:')
Dominique Pelle1e469c72021-05-24 19:37:26 +0200188 let save_tags = &tags
189 set tags=
190 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
191 let a = execute('cstag index_to_key')
192 call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
193 let &tags = save_tags
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200194
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200195 " Test: 'cst' option
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200196 set nocst
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200197 call assert_fails('tag TEST_COUNT', 'E433:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200198 set cst
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200199 let a = execute('tag TEST_COUNT')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200200 call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
201 call assert_equal('#define TEST_COUNT 50000', getline('.'))
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200202 let a = execute('tags')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200203 call assert_match('1 1 TEST_COUNT\s\+\d\+\s\+#define index_to_key', a)
204
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200205 " Test: 'cscoperelative'
206 call mkdir('Xcscoperelative')
207 cd Xcscoperelative
208 let a = execute('cs find g test_mf_hash')
209 call assert_notequal('test_mf_hash(void)', getline('.'))
210 set cscoperelative
211 let a = execute('cs find g test_mf_hash')
212 call assert_equal('test_mf_hash(void)', getline('.'))
213 set nocscoperelative
214 cd ..
215 call delete('Xcscoperelative', 'd')
216
Dominique Pelle1e469c72021-05-24 19:37:26 +0200217 " Test: E259: no match found
218 call assert_fails('cscope find g DOES_NOT_EXIST', 'E259:')
219
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200220 " Test: this should trigger call to cs_print_tags()
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200221 " Unclear how to check result though, we just exercise the code.
222 set cst cscopequickfix=s0
223 call feedkeys(":cs find s main\<CR>", 't')
224
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200225 " Test: cscope kill
Dominique Pelle1e469c72021-05-24 19:37:26 +0200226 call assert_fails('cscope kill', 'E560:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200227 call assert_fails('cscope kill 2', 'E261:')
228 call assert_fails('cscope kill xxx', 'E261:')
229
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200230 let a = execute('cscope kill 0')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200231 call assert_match('cscope connection 0 closed', a)
232
233 cscope add Xcscope.out
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200234 let a = execute('cscope kill Xcscope.out')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200235 call assert_match('cscope connection Xcscope.out closed', a)
236
237 cscope add Xcscope.out .
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200238 let a = execute('cscope kill -1')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200239 call assert_match('cscope connection .*Xcscope.out closed', a)
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200240 let a = execute('cscope kill -1')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200241 call assert_equal('', a)
242
Bram Moolenaardc215522022-09-25 17:03:26 +0100243 " Test: 'csprg' option invalid command
244 call assert_equal('cscope', &csprg)
245 set csprg=doesnotexist
246 call assert_fails('cscope add Xcscope2.out', 'E609:')
247 set csprg=cscope
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200248
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200249 " Test: multiple cscope connections
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200250 cscope add Xcscope.out
251 cscope add Xcscope2.out . -C
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200252 let a = execute('cscope show')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200253 call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
254 call assert_match('\n 1 \d\+.*Xcscope2.out\s*\.', a)
255
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200256 " Test: test Ex command line completion
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200257 call feedkeys(":cs \<C-A>\<C-B>\"\<CR>", 'tx')
258 call assert_equal('"cs add find help kill reset show', @:)
259
260 call feedkeys(":scs \<C-A>\<C-B>\"\<CR>", 'tx')
261 call assert_equal('"scs find', @:)
262
263 call feedkeys(":cs find \<C-A>\<C-B>\"\<CR>", 'tx')
264 call assert_equal('"cs find a c d e f g i s t', @:)
265
266 call feedkeys(":cs kill \<C-A>\<C-B>\"\<CR>", 'tx')
267 call assert_equal('"cs kill -1 0 1', @:)
268
269 call feedkeys(":cs add Xcscope\<C-A>\<C-B>\"\<CR>", 'tx')
270 call assert_equal('"cs add Xcscope.out Xcscope2.out', @:)
271
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200272 " Test: cscope_connection()
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200273 call assert_equal(cscope_connection(), 1)
274 call assert_equal(cscope_connection(0, 'out'), 1)
275 call assert_equal(cscope_connection(0, 'xxx'), 1)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200276
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200277 call assert_equal(cscope_connection(1, 'out'), 1)
278 call assert_equal(cscope_connection(1, 'xxx'), 0)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200279
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200280 call assert_equal(cscope_connection(2, 'out'), 0)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200281 call assert_equal(cscope_connection(2, getcwd() .. '/Xcscope.out', 1), 1)
282
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200283 call assert_equal(cscope_connection(3, 'xxx', '..'), 0)
284 call assert_equal(cscope_connection(3, 'out', 'xxx'), 0)
285 call assert_equal(cscope_connection(3, 'out', '.'), 1)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200286
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200287 call assert_equal(cscope_connection(4, 'out', '.'), 0)
288
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200289 call assert_equal(cscope_connection(5, 'out'), 0)
290 call assert_equal(cscope_connection(-1, 'out'), 0)
291
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200292 call CscopeSetupOrClean(0)
Bram Moolenaar2196bca2018-07-15 17:36:32 +0200293endfunc
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200294
Bram Moolenaar2196bca2018-07-15 17:36:32 +0200295" Test ":cs add {dir}" (add the {dir}/cscope.out database)
296func Test_cscope_add_dir()
Bram Moolenaar45bbaef2022-09-08 16:39:22 +0100297 call mkdir('Xcscopedir', 'pD')
Bram Moolenaar320bf2d2018-08-22 20:06:26 +0200298
299 " Cscope doesn't handle symlinks, so this needs to be resolved in case a
300 " shadow directory is being used.
301 let memfile = resolve('../memfile_test.c')
302 call system('cscope -bk -fXcscopedir/cscope.out ' . memfile)
303
Bram Moolenaar2196bca2018-07-15 17:36:32 +0200304 cs add Xcscopedir
305 let a = execute('cscope show')
306 let lines = split(a, "\n", 1)
307 call assert_equal(3, len(lines))
308 call assert_equal(' # pid database name prepend path', lines[0])
309 call assert_equal('', lines[1])
310 call assert_match('^ 0 \d\+.*Xcscopedir/cscope.out\s\+<none>$', lines[2])
311
312 cs kill -1
313 call delete('Xcscopedir/cscope.out')
314 call assert_fails('cs add Xcscopedir', 'E563:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200315endfunc
316
Bram Moolenaar6d20e172016-07-13 22:44:12 +0200317func Test_cscopequickfix()
318 set cscopequickfix=s-,g-,d+,c-,t+,e-,f0,i-,a-
319 call assert_equal('s-,g-,d+,c-,t+,e-,f0,i-,a-', &cscopequickfix)
320
321 call assert_fails('set cscopequickfix=x-', 'E474:')
322 call assert_fails('set cscopequickfix=s', 'E474:')
323 call assert_fails('set cscopequickfix=s7', 'E474:')
324 call assert_fails('set cscopequickfix=s-a', 'E474:')
325endfunc
Bram Moolenaaredf634e2016-08-02 23:01:40 +0200326
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200327func Test_withoutCscopeConnection()
328 call assert_equal(cscope_connection(), 0)
329
330 call assert_fails('cscope find s main', 'E567:')
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200331 let a = execute('cscope show')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200332 call assert_match('no cscope connections', a)
Bram Moolenaaredf634e2016-08-02 23:01:40 +0200333endfunc
334
Bram Moolenaaredf634e2016-08-02 23:01:40 +0200335
336" vim: shiftwidth=2 sts=2 expandtab