comparison 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
comparison
equal deleted inserted replaced
19424:38c3f2b16596 19425:67fbe280a502
181 call assert_fails('call finddir("x", [])', 'E730:') 181 call assert_fails('call finddir("x", [])', 'E730:')
182 call assert_fails('call finddir("x", "", [])', 'E745:') 182 call assert_fails('call finddir("x", "", [])', 'E745:')
183 call assert_fails('call finddir("x", "**x")', 'E343:') 183 call assert_fails('call finddir("x", "**x")', 'E343:')
184 call assert_fails('call finddir("x", repeat("x", 5000))', 'E854:') 184 call assert_fails('call finddir("x", repeat("x", 5000))', 'E854:')
185 endfunc 185 endfunc
186
187 " Test for the :find, :sfind and :tabfind commands
188 func Test_find_cmd()
189 new
190 let save_path = &path
191 let save_dir = getcwd()
192 set path=.,./**/*
193 call CreateFiles()
194 cd Xdir1
195
196 " Test for :find
197 find foo
198 call assert_equal('foo', expand('%:.'))
199 2find foo
200 call assert_equal('Xdir2/foo', expand('%:.'))
201 call assert_fails('3find foo', 'E347:')
202
203 " Test for :sfind
204 enew
205 sfind barfoo
206 call assert_equal('Xdir2/Xdir3/barfoo', expand('%:.'))
207 call assert_equal(3, winnr('$'))
208 close
209 call assert_fails('sfind baz', 'E345:')
210 call assert_equal(2, winnr('$'))
211
212 " Test for :tabfind
213 enew
214 tabfind foobar
215 call assert_equal('Xdir2/foobar', expand('%:.'))
216 call assert_equal(2, tabpagenr('$'))
217 tabclose
218 call assert_fails('tabfind baz', 'E345:')
219 call assert_equal(1, tabpagenr('$'))
220
221 call chdir(save_dir)
222 call CleanFiles()
223 let &path = save_path
224 close
225 endfunc