aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_findfile.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_findfile.vim')
-rw-r--r--src/nvim/testdir/test_findfile.vim28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_findfile.vim b/src/nvim/testdir/test_findfile.vim
index 5a20475d3d..0f4b30aec2 100644
--- a/src/nvim/testdir/test_findfile.vim
+++ b/src/nvim/testdir/test_findfile.vim
@@ -193,12 +193,14 @@ func Test_find_cmd()
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
@@ -207,6 +209,7 @@ func Test_find_cmd()
close
call assert_fails('sfind baz', 'E345:')
call assert_equal(2, winnr('$'))
+
" Test for :tabfind
enew
tabfind foobar
@@ -215,7 +218,8 @@ func Test_find_cmd()
tabclose
call assert_fails('tabfind baz', 'E345:')
call assert_equal(1, tabpagenr('$'))
- " call chdir(save_dir)
+
+ call chdir(save_dir)
exe 'cd ' . save_dir
call CleanFiles()
let &path = save_path
@@ -226,4 +230,26 @@ func Test_find_cmd()
call assert_fails('tabfind', 'E471:')
endfunc
+func Test_find_non_existing_path()
+ new
+ let save_path = &path
+ let save_dir = getcwd()
+ call mkdir('dir1/dir2', 'p')
+ call writefile([], 'dir1/file.txt')
+ call writefile([], 'dir1/dir2/base.txt')
+ call chdir('dir1/dir2')
+ e base.txt
+ set path=../include
+
+ call assert_fails(':find file.txt', 'E345:')
+
+ call chdir(save_dir)
+ bw!
+ call delete('dir1/dir2/base.txt', 'rf')
+ call delete('dir1/dir2', 'rf')
+ call delete('dir1/file.txt', 'rf')
+ call delete('dir1', 'rf')
+ let &path = save_path
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab