comparison src/testdir/test_find_complete.vim @ 18568:26a04a556982 v8.1.2278

patch 8.1.2278: using "cd" with "exe" may fail Commit: https://github.com/vim/vim/commit/3503d7c94a6c8c2a5ca1665d648d0cb81afcc863 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 9 20:10:17 2019 +0100 patch 8.1.2278: using "cd" with "exe" may fail Problem: Using "cd" with "exe" may fail. Solution: Use chdir() instead.
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Nov 2019 20:15:04 +0100
parents 0dfd846f9190
children 9412cc889072
comparison
equal deleted inserted replaced
18567:ed3a8eb92f76 18568:26a04a556982
34 close 34 close
35 35
36 " We shouldn't find any file till this point 36 " We shouldn't find any file till this point
37 37
38 call mkdir('in/path', 'p') 38 call mkdir('in/path', 'p')
39 exe 'cd ' . cwd 39 call chdir(cwd)
40 call writefile(['Holy Grail'], 'Xfind/file.txt') 40 call writefile(['Holy Grail'], 'Xfind/file.txt')
41 call writefile(['Jimmy Hoffa'], 'Xfind/in/file.txt') 41 call writefile(['Jimmy Hoffa'], 'Xfind/in/file.txt')
42 call writefile(['Another Holy Grail'], 'Xfind/in/stuff.txt') 42 call writefile(['Another Holy Grail'], 'Xfind/in/stuff.txt')
43 call writefile(['E.T.'], 'Xfind/in/path/file.txt') 43 call writefile(['E.T.'], 'Xfind/in/path/file.txt')
44 44
131 call assert_equal('Voyager 1', getline(1)) 131 call assert_equal('Voyager 1', getline(1))
132 call feedkeys(":find voyager\t\t\n", "xt") 132 call feedkeys(":find voyager\t\t\n", "xt")
133 call assert_equal('Voyager 2', getline(1)) 133 call assert_equal('Voyager 2', getline(1))
134 134
135 " Check for correct handling of shorten_fname()'s behavior on windows 135 " Check for correct handling of shorten_fname()'s behavior on windows
136 exec "cd " . cwd . "/Xfind/in" 136 call chdir(cwd .. "/Xfind/in")
137 call feedkeys(":find file\t\n", "xt") 137 call feedkeys(":find file\t\n", "xt")
138 call assert_equal('Jimmy Hoffa', getline(1)) 138 call assert_equal('Jimmy Hoffa', getline(1))
139 139
140 " Test for relative to current buffer 'path' item 140 " Test for relative to current buffer 'path' item
141 exec "cd " . cwd . "/Xfind/" 141 call chdir(cwd . "/Xfind/")
142 set path=./path 142 set path=./path
143 " Open the file where Jimmy Hoffa is found 143 " Open the file where Jimmy Hoffa is found
144 e in/file.txt 144 e in/file.txt
145 " Find the file containing 'E.T.' in the Xfind/in/path directory 145 " Find the file containing 'E.T.' in the Xfind/in/path directory
146 call feedkeys(":find file\t\n", "xt") 146 call feedkeys(":find file\t\n", "xt")
155 " Search for the file containing Holy Grail in same directory as in/path.txt 155 " Search for the file containing Holy Grail in same directory as in/path.txt
156 call feedkeys(":find stu\t\n", "xt") 156 call feedkeys(":find stu\t\n", "xt")
157 call assert_equal('Another Holy Grail', getline(1)) 157 call assert_equal('Another Holy Grail', getline(1))
158 158
159 enew | only 159 enew | only
160 exe 'cd ' . cwd 160 call chdir(cwd)
161 call delete('Xfind', 'rf') 161 call delete('Xfind', 'rf')
162 set path& 162 set path&
163 endfunc 163 endfunc