diff src/testdir/test_taglist.vim @ 11225:d3415ec1cdaf v8.0.0499

patch 8.0.0499: taglist() does not prioritize tags for a buffer commit https://github.com/vim/vim/commit/c6aafbaf3ea755e3ab4ee2e3045911126a08b038 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 21 17:09:10 2017 +0100 patch 8.0.0499: taglist() does not prioritize tags for a buffer Problem: taglist() does not prioritize tags for a buffer. Solution: Add an optional buffer argument. (Duncan McDougall, closes https://github.com/vim/vim/issues/1194)
author Christian Brabandt <cb@256bit.org>
date Tue, 21 Mar 2017 17:15:05 +0100
parents
children c7ba89661c39
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/src/testdir/test_taglist.vim
@@ -0,0 +1,21 @@
+" test 'taglist' function
+
+func Test_taglist()
+  call writefile([
+	\ "FFoo\tXfoo\t1",
+	\ "FBar\tXfoo\t2",
+	\ "BFoo\tXbar\t1",
+	\ "BBar\tXbar\t2"
+	\ ], 'Xtags')
+  set tags=Xtags
+  split Xtext
+
+  call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo"), {i, v -> v.name}))
+  call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xtext"), {i, v -> v.name}))
+  call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xfoo"), {i, v -> v.name}))
+  call assert_equal(['BFoo', 'FFoo'], map(taglist("Foo", "Xbar"), {i, v -> v.name}))
+
+  call delete('Xtags')
+  bwipe
+endfunc
+