Mercurial > vim
comparison src/testdir/test_tagjump.vim @ 20893:c78689fa0633 v8.2.0998
patch 8.2.0998: not all tag code is tested
Commit: https://github.com/vim/vim/commit/3d9207ad2fc98b4f92f77b5a3d52a3a4d25b9561
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 17 22:58:35 2020 +0200
patch 8.2.0998: not all tag code is tested
Problem: Not all tag code is tested.
Solution: Add a few more test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6284)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Jun 2020 23:00:03 +0200 |
parents | 8b775cd23555 |
children | 505d97ea54da |
comparison
equal
deleted
inserted
replaced
20892:c98abb80d60d | 20893:c78689fa0633 |
---|---|
261 \ ], 'Xtags') | 261 \ ], 'Xtags') |
262 set tags=Xtags | 262 set tags=Xtags |
263 ta foo | 263 ta foo |
264 call assert_equal('void foo() {}', getline('.')) | 264 call assert_equal('void foo() {}', getline('.')) |
265 | 265 |
266 call delete('Xtags') | 266 " Test for including another tags file |
267 call writefile([ | |
268 \ "\x0c", | |
269 \ "Xmain.c,64", | |
270 \ "void foo() {}\x7ffoo\x011,0", | |
271 \ "\x0c", | |
272 \ "Xnonexisting,include", | |
273 \ "\x0c", | |
274 \ "Xtags2,include" | |
275 \ ], 'Xtags') | |
276 call writefile([ | |
277 \ "\x0c", | |
278 \ "Xmain.c,64", | |
279 \ "int main(int argc, char **argv)\x7fmain\x012,14", | |
280 \ ], 'Xtags2') | |
281 tag main | |
282 call assert_equal(2, line('.')) | |
283 | |
284 " corrupted tag line | |
285 call writefile([ | |
286 \ "\x0c", | |
287 \ "Xmain.c,8", | |
288 \ "int main" | |
289 \ ], 'Xtags', 'b') | |
290 call assert_fails('tag foo', 'E426:') | |
291 | |
292 " invalid line number | |
293 call writefile([ | |
294 \ "\x0c", | |
295 \ "Xmain.c,64", | |
296 \ "void foo() {}\x7ffoo\x0abc,0", | |
297 \ ], 'Xtags') | |
298 call assert_fails('tag foo', 'E426:') | |
299 | |
300 " invalid tag name | |
301 call writefile([ | |
302 \ "\x0c", | |
303 \ "Xmain.c,64", | |
304 \ ";;;;\x7f1,0", | |
305 \ ], 'Xtags') | |
306 call assert_fails('tag foo', 'E426:') | |
307 | |
308 call delete('Xtags') | |
309 call delete('Xtags2') | |
267 call delete('Xmain.c') | 310 call delete('Xmain.c') |
311 set tags& | |
268 bwipe! | 312 bwipe! |
269 endfunc | 313 endfunc |
270 | 314 |
271 " Test for getting and modifying the tag stack | 315 " Test for getting and modifying the tag stack |
272 func Test_getsettagstack() | 316 func Test_getsettagstack() |
1266 call setline(1, ' /* comment') | 1310 call setline(1, ' /* comment') |
1267 call assert_beeps('normal! 15|]/') | 1311 call assert_beeps('normal! 15|]/') |
1268 close! | 1312 close! |
1269 endfunc | 1313 endfunc |
1270 | 1314 |
1315 " Test for the 'taglength' option | |
1316 func Test_tag_length() | |
1317 set tags=Xtags | |
1318 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", | |
1319 \ "tame\tXfile1\t1;", | |
1320 \ "tape\tXfile2\t1;"], 'Xtags') | |
1321 call writefile(['tame'], 'Xfile1') | |
1322 call writefile(['tape'], 'Xfile2') | |
1323 | |
1324 " Jumping to the tag 'tape', should instead jump to 'tame' | |
1325 new | |
1326 set taglength=2 | |
1327 tag tape | |
1328 call assert_equal('Xfile1', @%) | |
1329 " Tag search should jump to the right tag | |
1330 enew | |
1331 tag /^tape$ | |
1332 call assert_equal('Xfile2', @%) | |
1333 | |
1334 call delete('Xtags') | |
1335 call delete('Xfile1') | |
1336 call delete('Xfile2') | |
1337 set tags& taglength& | |
1338 endfunc | |
1339 | |
1271 " vim: shiftwidth=2 sts=2 expandtab | 1340 " vim: shiftwidth=2 sts=2 expandtab |