From f4e5cd200afb72cb6f8a1f7af04f9dfff9d9c6e5 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 7 May 2019 03:04:19 -0400 Subject: 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 vim/vim#2979) https://github.com/vim/vim/commit/46577b5e5445c4aaa1e7ae1764373d11dae71663 --- src/nvim/testdir/test_taglist.vim | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_taglist.vim b/src/nvim/testdir/test_taglist.vim index f4e939254a..ea0a6b9678 100644 --- a/src/nvim/testdir/test_taglist.vim +++ b/src/nvim/testdir/test_taglist.vim @@ -1,4 +1,4 @@ -" test 'taglist' function and :tags command +" test taglist(), tagfiles() functions and :tags command func Test_taglist() call writefile([ @@ -74,3 +74,26 @@ func Test_tagsfile_without_trailing_newline() call delete('Xtags') 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 -- cgit