Mercurial > vim
view src/testdir/test_taglist.vim @ 15284:c31e4b1fa4fd v8.1.0650
patch 8.1.0650: command line argument -q [errorfile] is not tested
commit https://github.com/vim/vim/commit/54948183d210f5117271bb5710752da24054fade
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 28 18:32:56 2018 +0100
patch 8.1.0650: command line argument -q [errorfile] is not tested
Problem: Command line argument -q [errorfile] is not tested.
Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/3730)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 28 Dec 2018 18:45:05 +0100 |
parents | 4afe2386aae8 |
children | 37d31fc37a5a |
line wrap: on
line source
" test taglist(), tagfiles() functions and :tags command 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 func Test_taglist_native_etags() if !has('emacs_tags') return endif call writefile([ \ "\x0c", \ "src/os_unix.c,13491", \ "set_signals(\x7f1335,32699", \ "reset_signals(\x7f1407,34136", \ ], 'Xtags') set tags=Xtags call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']], \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]})) call delete('Xtags') endfunc func Test_taglist_ctags_etags() if !has('emacs_tags') return endif call writefile([ \ "\x0c", \ "src/os_unix.c,13491", \ "set_signals(void)\x7fset_signals\x011335,32699", \ "reset_signals(void)\x7freset_signals\x011407,34136", \ ], 'Xtags') set tags=Xtags call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']], \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]})) call delete('Xtags') endfunc 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