Mercurial > vim
diff src/testdir/test_findfile.vim @ 19425:67fbe280a502 v8.2.0270
patch 8.2.0270: some code not covered by tests
Commit: https://github.com/vim/vim/commit/bc2b71d44a0b90b6aeb3534a76912fccbe5577df
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 17 21:33:30 2020 +0100
patch 8.2.0270: some code not covered by tests
Problem: Some code not covered by tests.
Solution: Add test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5649)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 17 Feb 2020 21:45:04 +0100 |
parents | 26a04a556982 |
children | 9412cc889072 |
line wrap: on
line diff
--- a/src/testdir/test_findfile.vim +++ b/src/testdir/test_findfile.vim @@ -183,3 +183,43 @@ func Test_finddir_error() call assert_fails('call finddir("x", "**x")', 'E343:') call assert_fails('call finddir("x", repeat("x", 5000))', 'E854:') endfunc + +" Test for the :find, :sfind and :tabfind commands +func Test_find_cmd() + new + let save_path = &path + let save_dir = getcwd() + set path=.,./**/* + call CreateFiles() + cd Xdir1 + + " Test for :find + find foo + call assert_equal('foo', expand('%:.')) + 2find foo + call assert_equal('Xdir2/foo', expand('%:.')) + call assert_fails('3find foo', 'E347:') + + " Test for :sfind + enew + sfind barfoo + call assert_equal('Xdir2/Xdir3/barfoo', expand('%:.')) + call assert_equal(3, winnr('$')) + close + call assert_fails('sfind baz', 'E345:') + call assert_equal(2, winnr('$')) + + " Test for :tabfind + enew + tabfind foobar + call assert_equal('Xdir2/foobar', expand('%:.')) + call assert_equal(2, tabpagenr('$')) + tabclose + call assert_fails('tabfind baz', 'E345:') + call assert_equal(1, tabpagenr('$')) + + call chdir(save_dir) + call CleanFiles() + let &path = save_path + close +endfunc