Skip to content

Commit 1e469c7

Browse files
dpellebrammool
authored andcommitted
patch 8.2.2884: not enough cscope code is covered by tests
Problem: Not enough cscope code is covered by tests. Solution: Add a few test cases. (Dominique Pellé, closes #8246)
1 parent e97c7c9 commit 1e469c7

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/testdir/test_cscope.vim

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ func Test_cscopeWithCscopeConnections()
119119
endfor
120120

121121
" Test: Invalid find command
122+
call assert_fails('cs find', 'E560:')
122123
call assert_fails('cs find x', 'E560:')
123124

124125
if has('float')
@@ -180,12 +181,19 @@ func Test_cscopeWithCscopeConnections()
180181
let a = execute('cstag TEST_COUNT')
181182
call assert_match('(1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000', a)
182183
call assert_equal('#define TEST_COUNT 50000', getline('.'))
184+
call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
183185
set csto=1
184186
let a = execute('cstag index_to_key')
185187
call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
186188
call assert_equal('#define index_to_key(i) ((i) ^ 15167)', getline('.'))
187-
call assert_fails('cstag xxx', 'E257:')
189+
call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
188190
call assert_fails('cstag', 'E562:')
191+
let save_tags = &tags
192+
set tags=
193+
call assert_fails('cstag DOES_NOT_EXIST', 'E257:')
194+
let a = execute('cstag index_to_key')
195+
call assert_match('(1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)', a)
196+
let &tags = save_tags
189197

190198
" Test: 'cst' option
191199
set nocst
@@ -209,12 +217,16 @@ func Test_cscopeWithCscopeConnections()
209217
cd ..
210218
call delete('Xcscoperelative', 'd')
211219

220+
" Test: E259: no match found
221+
call assert_fails('cscope find g DOES_NOT_EXIST', 'E259:')
222+
212223
" Test: this should trigger call to cs_print_tags()
213224
" Unclear how to check result though, we just exercise the code.
214225
set cst cscopequickfix=s0
215226
call feedkeys(":cs find s main\<CR>", 't')
216227

217228
" Test: cscope kill
229+
call assert_fails('cscope kill', 'E560:')
218230
call assert_fails('cscope kill 2', 'E261:')
219231
call assert_fails('cscope kill xxx', 'E261:')
220232

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2884,
753755
/**/
754756
2883,
755757
/**/

0 commit comments

Comments
 (0)