view src/testdir/test73.in @ 9403:9b048dced116 v7.4.1983

commit https://github.com/vim/vim/commit/75464dc434c43efac60e8bfd9bec2a8b736407e9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 2 20:27:50 2016 +0200 patch 7.4.1983 Problem: farsi.c and arabic.c are included in a strange way. Solution: Build them like other files.
author Christian Brabandt <cb@256bit.org>
date Sat, 02 Jul 2016 20:30:06 +0200
parents 05e7d084c6c2
children ae45d497868f
line wrap: on
line source

Tests for find completion.

STARTTEST
:so small.vim
:" Do all test in a separate window to avoid E211 when we recursively
:" delete the Xfind directory during cleanup
:"
:" This will cause a few errors, do it silently.
:set visualbell
:set nocp viminfo+=nviminfo
:"
:" On windows a stale "Xfind" directory may exist, remove it so that
:" we start from a clean state.
:call delete("Xfind", "rf")
:new
:let cwd=getcwd()
:let test_out = cwd . '/test.out'
:call mkdir('Xfind')
:cd Xfind
:set path=
:find 	
:exec "w! " . test_out
:close
:new
:set path=.
:find 	
:exec "w >>" . test_out
:close
:new
:set path=.,,
:find 	
:exec "w >>" . test_out
:close
:new
:set path=./**
:find 	
:exec "w >>" . test_out
:close
:new
:" We shouldn't find any file at this point, test.out must be empty.
:call mkdir('in')
:cd in
:call mkdir('path')
:exec "cd " . cwd
:e Xfind/file.txt
SHoly Grail:w
:e Xfind/in/file.txt
SJimmy Hoffa:w
:e Xfind/in/stuff.txt
SAnother Holy Grail:w
:e Xfind/in/path/file.txt
SE.T.:w
:set path=Xfind/**
:find file	
:exec "w >>" . test_out
:find file		
:exec "w >>" . test_out
:find file			
:exec "w >>" . test_out
:" Rerun the previous three find completions, using fullpath in 'path'
:exec "set path=" . cwd . "/Xfind/**"
:find file	
:exec "w >>" .  test_out
:find file		
:exec "w >>" . test_out
:find file			
:exec "w >>" . test_out
:" Same steps again, using relative and fullpath items that point to the same
:" recursive location.
:" This is to test that there are no duplicates in the completion list.
:exec "set path+=Xfind/**"
:find file	
:exec "w >>" .  test_out
:find file		
:exec "w >>" . test_out
:find file			
:exec "w >>" . test_out
:find file		
:" Test find completion for directory of current buffer, which at this point
:" is Xfind/in/file.txt.
:set path=.
:find st	
:exec "w >>" .  test_out
:" Test find completion for empty path item ",," which is the current directory
:cd Xfind
:set path=,,
:find f		
:exec "w >>" . test_out
:" Test shortening of
:"
:"    foo/x/bar/voyager.txt
:"    foo/y/bar/voyager.txt
:"
:" When current directory is above foo/ they should be shortened to (in order
:" of appearance):
:"
:"    x/bar/voyager.txt
:"    y/bar/voyager.txt
:call mkdir('foo')
:cd foo
:call mkdir('x')
:call mkdir('y')
:cd x
:call mkdir('bar')
:cd ..
:cd y
:call mkdir('bar')
:cd ..
:cd ..
:" We should now be in the Xfind directory
:e foo/x/bar/voyager.txt
SVoyager 1:w
:e foo/y/bar/voyager.txt
SVoyager 2:w
:exec "set path=" . cwd . "/Xfind/**"
:find voyager	
:exec "w >>" . test_out
:find voyager		
:exec "w >>" . test_out
:"
:" When current directory is .../foo/y/bar they should be shortened to (in
:" order of appearance):
:"
:"    ./voyager.txt
:"    x/bar/voyager.txt
:cd foo
:cd y
:cd bar
:find voyager	
:exec "w >> " . test_out
:find voyager		
:exec "w >> " . test_out
:" Check the opposite too:
:cd ..
:cd ..
:cd x
:cd bar
:find voyager	
:exec "w >> " . test_out
:find voyager		
:exec "w >> " . test_out
:" Check for correct handling of shorten_fname()'s behavior on windows
:exec "cd " . cwd . "/Xfind/in"
:find file	
:exec "w >>" . test_out
:" Test for relative to current buffer 'path' item
:exec "cd " . cwd . "/Xfind/"
:set path=./path
:" Open the file where Jimmy Hoffa is found
:e in/file.txt
:" Find the file containing 'E.T.' in the Xfind/in/path directory
:find file	
:exec "w >>" . test_out
:"
:" Test that completion works when path=.,,
:"
:set path=.,,
:" Open Jimmy Hoffa file
:e in/file.txt
:exec "w >>" . test_out
:" Search for the file containing Holy Grail in same directory as in/path.txt
:find stu	
:exec "w >>" . test_out
:q
:exec "cd " . cwd
:call delete("Xfind", "rf")
:qa!
ENDTEST