@@ -40,6 +40,8 @@ func Test_cscope1()
4040 call assert_true (0 )
4141 endtry
4242 call assert_fails (' cscope add Xcscope.out' , ' E568' )
43+ call assert_fails (' cscope add doesnotexist.out' , ' E563' )
44+ call assert_fails (' cscope kill 2' , ' E261' )
4345 " Test 1: Find this C-Symbol
4446 let a = execute (' cscope find s main' )
4547 " Test 1.1 test where it moves the cursor
@@ -89,9 +91,12 @@ func Test_cscope1()
8991 call assert_equal ([' ' ,' "Xmemfile_test.c" 143L, 3137C' ,' (1 of 1): <<global>> #include <assert.h>' ], split (a , ' \n' , 1 ))
9092 call assert_equal (' #include <assert.h>' , getline (' .' ))
9193
92- " Test 9: Find places where this symbol is assigned a value
94+ " Test 9: Invalid find command
95+ call assert_fails (' cs find x' , ' E560' )
96+
97+ " Test 10: Find places where this symbol is assigned a value
9398 " this needs a cscope >= 15.8
94- " unfortunatly , Travis has cscope version 15.7
99+ " unfortunately , Travis has cscope version 15.7
95100 let cscope_version= systemlist (' cscope --version' )[0 ]
96101 let cs_version= str2float (matchstr (cscope_version, ' \d\+\(\.\d\+\)\?' ))
97102 if cs_version >= 15.8
@@ -106,12 +111,12 @@ func Test_cscope1()
106111 call assert_equal (' item = mf_hash_find(&ht, key);' , getline (' .' ))
107112 endif
108113
109- " Test 10 : leading whitespace is not removed for cscope find text
114+ " Test 11 : leading whitespace is not removed for cscope find text
110115 let a = execute (' cscope find t test_mf_hash' )
111116 call assert_equal ([' ' , ' (1 of 1): <<<unknown>>> test_mf_hash();' ], split (a , ' \n' , 1 ))
112117 call assert_equal (' test_mf_hash();' , getline (' .' ))
113118
114- " Test 11 : cscope help
119+ " Test 12 : cscope help
115120 let a = execute (' cscope help' )
116121 call assert_match (' ^cscope commands:\n' , a )
117122 call assert_match (' \nadd :' , a )
@@ -121,20 +126,44 @@ func Test_cscope1()
121126 call assert_match (' \nreset: Reinit all connections' , a )
122127 call assert_match (' \nshow : Show connections' , a )
123128
124- " Test 12 : reset connections
129+ " Test 13 : reset connections
125130 let a = execute (' cscope reset' )
126131 call assert_match (' \nAdded cscope database.*Xcscope.out (#0)' , a )
127132 call assert_match (' \nAll cscope databases reset' , a )
128133
129- " Test 13 : cscope show
134+ " Test 14 : cscope show
130135 let a = execute (' cscope show' )
131136 call assert_match (' \n 0 \d\+.*Xcscope.out\s*<none>' , a )
132137
133- " Test 14: 'csprg' option
138+ " Test 15: cstag and 'csto' option
139+ set csto = 0
140+ let a = execute (' cstag TEST_COUNT' )
141+ call assert_match (' (1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000' , a )
142+ call assert_equal (' #define TEST_COUNT 50000' , getline (' .' ))
143+ set csto = 1
144+ let a = execute (' cstag index_to_key' )
145+ call assert_match (' (1 of 1): <<index_to_key>> #define index_to_key(i) ((i) ^ 15167)' , a )
146+ call assert_equal (' #define index_to_key(i) ((i) ^ 15167)' , getline (' .' ))
147+ call assert_fails (' cstag xxx' , ' E257' )
148+ call assert_fails (' cstag' , ' E562' )
149+
150+ " Test 15: 'csprg' option
134151 call assert_equal (' cscope' , &csprg )
135152
153+ " Test 16: 'cst' option
154+ set cst
155+ let a = execute (' tag TEST_COUNT' )
156+ call assert_match (' (1 of 1): <<TEST_COUNT>> #define TEST_COUNT 50000' , a )
157+ call assert_equal (' #define TEST_COUNT 50000' , getline (' .' ))
158+ set nocst
159+ call assert_fails (' tag TEST_COUNT' , ' E426' )
160+
136161 " CleanUp
137162 call CscopeSetupOrClean (0 )
163+
164+ " cscope command should fail after killing scope connection.
165+ call assert_fails (' cscope find s main' , ' E567' )
166+
138167endfunc
139168
140169" vim: shiftwidth = 2 sts = 2 expandtab
0 commit comments