1
0
forked from aniani/vim

patch 8.1.0133: tagfiles() can have duplicate entries

Problem:    tagfiles() can have duplicate entries.
Solution:   Simplify the filename to make checking for duplicates work better.
            Add a test. (Dominique Pelle, closes #2979)
This commit is contained in:
Bram Moolenaar
2018-06-30 22:40:42 +02:00
parent 4ff4814b38
commit 46577b5e54
3 changed files with 44 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
" test 'taglist' function and :tags command
" test taglist(), tagfiles() functions and :tags command
func Test_taglist()
call writefile([
@@ -61,3 +61,26 @@ func Test_tags_too_long()
call assert_fails('tag ' . repeat('x', 1020), 'E426')
tags
endfunc
func Test_tagfiles()
call assert_equal([], tagfiles())
call writefile(["FFoo\tXfoo\t1"], 'Xtags1')
call writefile(["FBar\tXbar\t1"], 'Xtags2')
set tags=Xtags1,Xtags2
call assert_equal(['Xtags1', 'Xtags2'], tagfiles())
help
let tf = tagfiles()
call assert_equal(1, len(tf))
call assert_equal(fnamemodify(expand('$VIMRUNTIME/doc/tags'), ':p:gs?\\?/?'),
\ fnamemodify(tf[0], ':p:gs?\\?/?'))
helpclose
call assert_equal(['Xtags1', 'Xtags2'], tagfiles())
set tags&
call assert_equal([], tagfiles())
call delete('Xtags1')
call delete('Xtags2')
bd
endfunc