blob: d29949c4e4259ddd915e2219321beaa47788e811 [file] [log] [blame]
Bram Moolenaar6d20e172016-07-13 22:44:12 +02001" Test for cscope commands.
2
Bram Moolenaarb46fecd2019-06-15 17:58:09 +02003source check.vim
4CheckFeature cscope
5CheckFeature quickfix
Bram Moolenaar8c5a2782019-08-07 23:07:07 +02006CheckExecutable cscope
Bram Moolenaar6d20e172016-07-13 22:44:12 +02007
Bram Moolenaar812ad4f2016-08-07 14:03:13 +02008func CscopeSetupOrClean(setup)
9 if a:setup
10 noa sp ../memfile_test.c
11 saveas! Xmemfile_test.c
12 call system('cscope -bk -fXcscope.out Xmemfile_test.c')
13 call system('cscope -bk -fXcscope2.out Xmemfile_test.c')
14 cscope add Xcscope.out
15 set cscopequickfix=s-,g-,d-,c-,t-,e-,f-,i-,a-
16 else
17 cscope kill -1
18 for file in ['Xcscope.out', 'Xcscope2.out', 'Xmemfile_test.c']
19 call delete(file)
20 endfo
21 endif
22endfunc
23
24func Test_cscopeWithCscopeConnections()
25 call CscopeSetupOrClean(1)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020026 " Test: E568: duplicate cscope database not added
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020027 try
28 set nocscopeverbose
29 cscope add Xcscope.out
30 set cscopeverbose
31 catch
Bram Moolenaar37175402017-03-18 20:18:45 +010032 call assert_report('exception thrown')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020033 endtry
Bram Moolenaare2e40752020-09-04 21:18:46 +020034 call assert_fails('cscope add', 'E560:')
35 call assert_fails('cscope add Xcscope.out', 'E568:')
36 call assert_fails('cscope add doesnotexist.out', 'E563:')
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020037 if has('unix')
38 call assert_fails('cscope add /dev/null', 'E564:')
39 endif
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020040
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020041 " Test: Find this C-Symbol
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020042 for cmd in ['cs find s main', 'cs find 0 main']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020043 let a = execute(cmd)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020044 " Test where it moves the cursor
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020045 call assert_equal('main(void)', getline('.'))
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020046 " Test the output of the :cs command
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020047 call assert_match('\n(1 of 1): <<main>> main(void )', a)
48 endfor
49
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020050 " Test: Find this definition
51 for cmd in ['cs find g test_mf_hash',
52 \ 'cs find 1 test_mf_hash',
53 \ 'cs find 1 test_mf_hash'] " leading space ignored.
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020054 exe cmd
55 call assert_equal(['', '/*', ' * Test mf_hash_*() functions.', ' */', ' static void', 'test_mf_hash(void)', '{'], getline(line('.')-5, line('.')+1))
56 endfor
57
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020058 " Test: Find functions called by this function
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020059 for cmd in ['cs find d test_mf_hash', 'cs find 2 test_mf_hash']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020060 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020061 call assert_match('\n(1 of 42): <<mf_hash_init>> mf_hash_init(&ht);', a)
62 call assert_equal(' mf_hash_init(&ht);', getline('.'))
63 endfor
64
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020065 " Test: Find functions calling this function
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020066 for cmd in ['cs find c test_mf_hash', 'cs find 3 test_mf_hash']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020067 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020068 call assert_match('\n(1 of 1): <<main>> test_mf_hash();', a)
69 call assert_equal(' test_mf_hash();', getline('.'))
70 endfor
71
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020072 " Test: Find this text string
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020073 for cmd in ['cs find t Bram', 'cs find 4 Bram']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020074 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020075 call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
76 call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
77 endfor
78
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020079 " Test: Find this egrep pattern
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020080 " test all matches returned by cscope
81 for cmd in ['cs find e ^\#includ.', 'cs find 6 ^\#includ.']
Bram Moolenaar259f26a2018-05-15 22:25:40 +020082 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020083 call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
84 call assert_equal('#include <assert.h>', getline('.'))
85 cnext
86 call assert_equal('#include "main.c"', getline('.'))
87 cnext
88 call assert_equal('#include "memfile.c"', getline('.'))
89 call assert_fails('cnext', 'E553:')
90 endfor
91
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +020092 " Test: Find the same egrep pattern using lcscope this time.
Bram Moolenaar259f26a2018-05-15 22:25:40 +020093 let a = execute('lcs find e ^\#includ.')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +020094 call assert_match('\n(1 of 3): <<<unknown>>> #include <assert.h>', a)
95 call assert_equal('#include <assert.h>', getline('.'))
96 lnext
97 call assert_equal('#include "main.c"', getline('.'))
98 lnext
99 call assert_equal('#include "memfile.c"', getline('.'))
100 call assert_fails('lnext', 'E553:')
101
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200102 " Test: Find this file
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200103 for cmd in ['cs find f Xmemfile_test.c', 'cs find 7 Xmemfile_test.c']
104 enew
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200105 let a = execute(cmd)
Bram Moolenaar3f40ce72020-07-05 14:10:13 +0200106 call assert_true(a =~ '"Xmemfile_test.c" \d\+L, \d\+B')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200107 call assert_equal('Xmemfile_test.c', @%)
108 endfor
109
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200110 " Test: Find files #including this file
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200111 for cmd in ['cs find i assert.h', 'cs find 8 assert.h']
112 enew
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200113 let a = execute(cmd)
Bram Moolenaar47922552016-08-30 10:56:50 +0200114 let alines = split(a, '\n', 1)
115 call assert_equal('', alines[0])
Bram Moolenaar3f40ce72020-07-05 14:10:13 +0200116 call assert_true(alines[1] =~ '"Xmemfile_test.c" \d\+L, \d\+B')
Bram Moolenaar47922552016-08-30 10:56:50 +0200117 call assert_equal('(1 of 1): <<global>> #include <assert.h>', alines[2])
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200118 call assert_equal('#include <assert.h>', getline('.'))
119 endfor
120
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200121 " Test: Invalid find command
Dominique Pelle1e469c72021-05-24 19:37:26 +0200122 call assert_fails('cs find', 'E560:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200123 call assert_fails('cs find x', 'E560:')
124
Bram Moolenaar73e28dc2022-09-17 21:08:33 +0100125 " Test: Find places where this symbol is assigned a value
126 " this needs a cscope >= 15.8
127 " unfortunately, Travis has cscope version 15.7
128 let cscope_version = systemlist('cscope --version')[0]
129 let cs_version = str2float(matchstr(cscope_version, '\d\+\(\.\d\+\)\?'))
130 if cs_version >= 15.8
131 for cmd in ['cs find a item', 'cs find 9 item']
132 let a = execute(cmd)
133 call assert_equal(['', '(1 of 4): <<test_mf_hash>> item = LALLOC_CLEAR_ONE(mf_hashitem_T);'], split(a, '\n', 1))
134 call assert_equal(' item = LALLOC_CLEAR_ONE(mf_hashitem_T);', getline('.'))
135 cnext
136 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
137 cnext
138 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
139 cnext
140 call assert_equal(' item = mf_hash_find(&ht, key);', getline('.'))
141 endfor
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200142 endif
143
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200144 " Test: leading whitespace is not removed for cscope find text
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200145 let a = execute('cscope find t test_mf_hash')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200146 call assert_equal(['', '(1 of 1): <<<unknown>>> test_mf_hash();'], split(a, '\n', 1))
147 call assert_equal(' test_mf_hash();', getline('.'))
148
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200149 " Test: test with scscope
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200150 let a = execute('scs find t Bram')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200151 call assert_match('(1 of 1): <<<unknown>>> \* VIM - Vi IMproved^Iby Bram Moolenaar', a)
152 call assert_equal(' * VIM - Vi IMproved by Bram Moolenaar', getline('.'))
153
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200154 " Test: cscope help
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200155 for cmd in ['cs', 'cs help', 'cs xxx']
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200156 let a = execute(cmd)
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200157 call assert_match('^cscope commands:\n', a)
158 call assert_match('\nadd :', a)
159 call assert_match('\nfind :', a)
160 call assert_match('\nhelp : Show this message', a)
161 call assert_match('\nkill : Kill a connection', a)
162 call assert_match('\nreset: Reinit all connections', a)
163 call assert_match('\nshow : Show connections', a)
164 endfor
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200165 let a = execute('scscope help')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200166 call assert_match('This cscope command does not support splitting the window\.', a)
167
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200168 " Test: reset connections
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200169 let a = execute('cscope reset')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200170 call assert_match('\nAdded cscope database.*Xcscope.out (#0)', a)
171 call assert_match('\nAll cscope databases reset', a)
172
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200173 " Test: cscope show
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200174 let a = execute('cscope show')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200175 call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
176
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200177 " Test: cstag and 'csto' option
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200178 set csto=0
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200179 let a = execute('cstag TEST_COUNT')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200180 call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
181 call assert_equal('#define TEST_COUNT 50000', getline('.'))
Dominique Pelle1e469c72021-05-24 19:37:26 +0200182 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200183 set csto=1
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200184 let a = execute('cstag index_to_key')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200185 call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
186 call assert_equal('#define index_to_key(i) ((i) ^ 15167)', getline('.'))
Dominique Pelle1e469c72021-05-24 19:37:26 +0200187 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200188 call assert_fails('cstag', 'E562:')
Dominique Pelle1e469c72021-05-24 19:37:26 +0200189 let save_tags = &tags
190 set tags=
191 call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
192 let a = execute('cstag index_to_key')
193 call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
194 let &tags = save_tags
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200195
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200196 " Test: 'cst' option
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200197 set nocst
Bram Moolenaar9b7bf9e2020-07-11 22:14:59 +0200198 call assert_fails('tag TEST_COUNT', 'E433:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200199 set cst
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200200 let a = execute('tag TEST_COUNT')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200201 call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
202 call assert_equal('#define TEST_COUNT 50000', getline('.'))
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200203 let a = execute('tags')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200204 call assert_match('1 1 TEST_COUNT\s\+\d\+\s\+#define index_to_key', a)
205
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200206 " Test: 'cscoperelative'
207 call mkdir('Xcscoperelative')
208 cd Xcscoperelative
209 let a = execute('cs find g test_mf_hash')
210 call assert_notequal('test_mf_hash(void)', getline('.'))
211 set cscoperelative
212 let a = execute('cs find g test_mf_hash')
213 call assert_equal('test_mf_hash(void)', getline('.'))
214 set nocscoperelative
215 cd ..
216 call delete('Xcscoperelative', 'd')
217
Dominique Pelle1e469c72021-05-24 19:37:26 +0200218 " Test: E259: no match found
219 call assert_fails('cscope find g DOES_NOT_EXIST', 'E259:')
220
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200221 " Test: this should trigger call to cs_print_tags()
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200222 " Unclear how to check result though, we just exercise the code.
223 set cst cscopequickfix=s0
224 call feedkeys(":cs find s main\<CR>", 't')
225
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200226 " Test: cscope kill
Dominique Pelle1e469c72021-05-24 19:37:26 +0200227 call assert_fails('cscope kill', 'E560:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200228 call assert_fails('cscope kill 2', 'E261:')
229 call assert_fails('cscope kill xxx', 'E261:')
230
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200231 let a = execute('cscope kill 0')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200232 call assert_match('cscope connection 0 closed', a)
233
234 cscope add Xcscope.out
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200235 let a = execute('cscope kill Xcscope.out')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200236 call assert_match('cscope connection Xcscope.out closed', a)
237
238 cscope add Xcscope.out .
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200239 let a = execute('cscope kill -1')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200240 call assert_match('cscope connection .*Xcscope.out closed', a)
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200241 let a = execute('cscope kill -1')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200242 call assert_equal('', a)
243
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200244 " Test: 'csprg' option
Bram Moolenaar37bb3b12022-06-21 17:40:47 +0100245 " Skip this with valgrind, it causes spurious leak reports
246 if !RunningWithValgrind()
247 call assert_equal('cscope', &csprg)
248 set csprg=doesnotexist
249 call assert_fails('cscope add Xcscope2.out', 'E262:')
250 set csprg=cscope
251 endif
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200252
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200253 " Test: multiple cscope connections
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200254 cscope add Xcscope.out
255 cscope add Xcscope2.out . -C
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200256 let a = execute('cscope show')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200257 call assert_match('\n 0 \d\+.*Xcscope.out\s*<none>', a)
258 call assert_match('\n 1 \d\+.*Xcscope2.out\s*\.', a)
259
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200260 " Test: test Ex command line completion
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200261 call feedkeys(":cs \<C-A>\<C-B>\"\<CR>", 'tx')
262 call assert_equal('"cs add find help kill reset show', @:)
263
264 call feedkeys(":scs \<C-A>\<C-B>\"\<CR>", 'tx')
265 call assert_equal('"scs find', @:)
266
267 call feedkeys(":cs find \<C-A>\<C-B>\"\<CR>", 'tx')
268 call assert_equal('"cs find a c d e f g i s t', @:)
269
270 call feedkeys(":cs kill \<C-A>\<C-B>\"\<CR>", 'tx')
271 call assert_equal('"cs kill -1 0 1', @:)
272
273 call feedkeys(":cs add Xcscope\<C-A>\<C-B>\"\<CR>", 'tx')
274 call assert_equal('"cs add Xcscope.out Xcscope2.out', @:)
275
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200276 " Test: cscope_connection()
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200277 call assert_equal(cscope_connection(), 1)
278 call assert_equal(cscope_connection(0, 'out'), 1)
279 call assert_equal(cscope_connection(0, 'xxx'), 1)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200280
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200281 call assert_equal(cscope_connection(1, 'out'), 1)
282 call assert_equal(cscope_connection(1, 'xxx'), 0)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200283
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200284 call assert_equal(cscope_connection(2, 'out'), 0)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200285 call assert_equal(cscope_connection(2, getcwd() .. '/Xcscope.out', 1), 1)
286
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200287 call assert_equal(cscope_connection(3, 'xxx', '..'), 0)
288 call assert_equal(cscope_connection(3, 'out', 'xxx'), 0)
289 call assert_equal(cscope_connection(3, 'out', '.'), 1)
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200290
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200291 call assert_equal(cscope_connection(4, 'out', '.'), 0)
292
Bram Moolenaard7ffc0b2020-04-05 15:36:16 +0200293 call assert_equal(cscope_connection(5, 'out'), 0)
294 call assert_equal(cscope_connection(-1, 'out'), 0)
295
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200296 call CscopeSetupOrClean(0)
Bram Moolenaar2196bca2018-07-15 17:36:32 +0200297endfunc
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200298
Bram Moolenaar2196bca2018-07-15 17:36:32 +0200299" Test ":cs add {dir}" (add the {dir}/cscope.out database)
300func Test_cscope_add_dir()
Bram Moolenaar45bbaef2022-09-08 16:39:22 +0100301 call mkdir('Xcscopedir', 'pD')
Bram Moolenaar320bf2d2018-08-22 20:06:26 +0200302
303 " Cscope doesn't handle symlinks, so this needs to be resolved in case a
304 " shadow directory is being used.
305 let memfile = resolve('../memfile_test.c')
306 call system('cscope -bk -fXcscopedir/cscope.out ' . memfile)
307
Bram Moolenaar2196bca2018-07-15 17:36:32 +0200308 cs add Xcscopedir
309 let a = execute('cscope show')
310 let lines = split(a, "\n", 1)
311 call assert_equal(3, len(lines))
312 call assert_equal(' # pid database name prepend path', lines[0])
313 call assert_equal('', lines[1])
314 call assert_match('^ 0 \d\+.*Xcscopedir/cscope.out\s\+<none>$', lines[2])
315
316 cs kill -1
317 call delete('Xcscopedir/cscope.out')
318 call assert_fails('cs add Xcscopedir', 'E563:')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200319endfunc
320
Bram Moolenaar6d20e172016-07-13 22:44:12 +0200321func Test_cscopequickfix()
322 set cscopequickfix=s-,g-,d+,c-,t+,e-,f0,i-,a-
323 call assert_equal('s-,g-,d+,c-,t+,e-,f0,i-,a-', &cscopequickfix)
324
325 call assert_fails('set cscopequickfix=x-', 'E474:')
326 call assert_fails('set cscopequickfix=s', 'E474:')
327 call assert_fails('set cscopequickfix=s7', 'E474:')
328 call assert_fails('set cscopequickfix=s-a', 'E474:')
329endfunc
Bram Moolenaaredf634e2016-08-02 23:01:40 +0200330
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200331func Test_withoutCscopeConnection()
332 call assert_equal(cscope_connection(), 0)
333
334 call assert_fails('cscope find s main', 'E567:')
Bram Moolenaar259f26a2018-05-15 22:25:40 +0200335 let a = execute('cscope show')
Bram Moolenaar812ad4f2016-08-07 14:03:13 +0200336 call assert_match('no cscope connections', a)
Bram Moolenaaredf634e2016-08-02 23:01:40 +0200337endfunc
338
Bram Moolenaaredf634e2016-08-02 23:01:40 +0200339
340" vim: shiftwidth=2 sts=2 expandtab