Mercurial > vim
comparison src/testdir/test_tagjump.vim @ 11008:0ecd07cd2e43 v8.0.0393
patch 8.0.0393: order of duplicate tags is not preserved
commit https://github.com/vim/vim/commit/98e83b295628bc29bc67bcc1adb8ae75d01b8e07
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 1 15:45:05 2017 +0100
patch 8.0.0393: order of duplicate tags is not preserved
Problem: When the same tag appears more than once, the order is
unpredictable. (Charles Campbell)
Solution: Besides using a dict for finding duplicates, use a grow array for
keeping the tags in sequence.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 01 Mar 2017 16:00:05 +0100 |
parents | 6bff81438f27 |
children | c45fb081391c |
comparison
equal
deleted
inserted
replaced
11007:14a0d274348d | 11008:0ecd07cd2e43 |
---|---|
33 call setline(1, ['empty', 'one()', 'empty']) | 33 call setline(1, ['empty', 'one()', 'empty']) |
34 write | 34 write |
35 tag one | 35 tag one |
36 call assert_equal(2, line('.')) | 36 call assert_equal(2, line('.')) |
37 | 37 |
38 bwipe! | |
38 set tags& | 39 set tags& |
39 call delete('Xtags') | 40 call delete('Xtags') |
40 call delete('Xfile1') | 41 call delete('Xfile1') |
42 endfunc | |
43 | |
44 func Test_duplicate_tagjump() | |
45 set tags=Xtags | |
46 call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", | |
47 \ "thesame\tXfile1\t1;\"\td\tfile:", | |
48 \ "thesame\tXfile1\t2;\"\td\tfile:", | |
49 \ "thesame\tXfile1\t3;\"\td\tfile:", | |
50 \ ], | |
51 \ 'Xtags') | |
52 new Xfile1 | |
53 call setline(1, ['thesame one', 'thesame two', 'thesame three']) | |
54 write | |
55 tag thesame | |
56 call assert_equal(1, line('.')) | |
57 tnext | |
58 call assert_equal(2, line('.')) | |
59 tnext | |
60 call assert_equal(3, line('.')) | |
61 | |
41 bwipe! | 62 bwipe! |
63 set tags& | |
64 call delete('Xtags') | |
65 call delete('Xfile1') | |
42 endfunc | 66 endfunc |
43 | 67 |
44 " Tests for [ CTRL-I and CTRL-W CTRL-I commands | 68 " Tests for [ CTRL-I and CTRL-W CTRL-I commands |
45 function Test_keyword_jump() | 69 function Test_keyword_jump() |
46 call writefile(["#include Xinclude", "", | 70 call writefile(["#include Xinclude", "", |