comparison src/testdir/test_history.vim @ 19581:848dc460adf0 v8.2.0347

patch 8.2.0347: various code not covered by tests Commit: https://github.com/vim/vim/commit/91ffc8a5f5c7b1c6979b3352a12ed779d11173a9 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 2 20:54:22 2020 +0100 patch 8.2.0347: various code not covered by tests Problem: Various code not covered by tests. Solution: Add more test coverage. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5720)
author Bram Moolenaar <Bram@vim.org>
date Mon, 02 Mar 2020 21:00:04 +0100
parents 43c04edcafec
children 595ea7f099cd
comparison
equal deleted inserted replaced
19580:e84b346be7f2 19581:848dc460adf0
174 call feedkeys("/\<Up>\<F2>\<Up>\<F2>\<Down>\<Down>\<F2>\<Esc>", 'xt') 174 call feedkeys("/\<Up>\<F2>\<Up>\<F2>\<Down>\<Down>\<F2>\<Esc>", 'xt')
175 call assert_equal(['pat2', 'pat1', ''], g:pat) 175 call assert_equal(['pat2', 'pat1', ''], g:pat)
176 cunmap <F2> 176 cunmap <F2>
177 delfunc SavePat 177 delfunc SavePat
178 178
179 " Search for a pattern that is not present in the history
180 call assert_beeps('call feedkeys("/a1b2\<Up>\<CR>", "xt")')
181
179 " Recall patterns with 'history' set to 0 182 " Recall patterns with 'history' set to 0
180 set history=0 183 set history=0
181 let @/ = 'abc' 184 let @/ = 'abc'
182 let cmd = 'call feedkeys("/\<Up>\<Down>\<S-Up>\<S-Down>\<CR>", "xt")' 185 let cmd = 'call feedkeys("/\<Up>\<Down>\<S-Up>\<S-Down>\<CR>", "xt")'
183 call assert_fails(cmd, 'E486:') 186 call assert_fails(cmd, 'E486:')
184 set history& 187 set history&
188
189 " Recall patterns till the end of history
190 set history=4
191 call histadd('/', 'pat')
192 call histdel('/')
193 call histadd('/', 'pat1')
194 call histadd('/', 'pat2')
195 call assert_beeps('call feedkeys("/\<Up>\<Up>\<Up>\<C-U>\<cr>", "xt")')
196 call assert_beeps('call feedkeys("/\<Down><cr>", "xt")')
197
198 " Test for wrapping around the history list
199 for i in range(3, 7)
200 call histadd('/', 'pat' .. i)
201 endfor
202 let upcmd = "\<up>\<up>\<up>\<up>\<up>"
203 let downcmd = "\<down>\<down>\<down>\<down>\<down>"
204 try
205 call feedkeys("/" .. upcmd .. "\<cr>", 'xt')
206 catch /E486:/
207 endtry
208 call assert_equal('pat4', @/)
209 try
210 call feedkeys("/" .. upcmd .. downcmd .. "\<cr>", 'xt')
211 catch /E486:/
212 endtry
213 call assert_equal('pat4', @/)
214
215 " Test for changing the search command separator in the history
216 call assert_fails('call feedkeys("/def/\<cr>", "xt")', 'E486:')
217 call assert_fails('call feedkeys("?\<up>\<cr>", "xt")', 'E486:')
218 call assert_equal('def?', histget('/', -1))
219
220 call assert_fails('call feedkeys("/ghi?\<cr>", "xt")', 'E486:')
221 call assert_fails('call feedkeys("?\<up>\<cr>", "xt")', 'E486:')
222 call assert_equal('ghi\?', histget('/', -1))
223
224 set history&
185 endfunc 225 endfunc
186 226
187 " Test for making sure the key value is not stored in history 227 " Test for making sure the key value is not stored in history
188 func Test_history_crypt_key() 228 func Test_history_crypt_key()
189 CheckFeature cryptv 229 CheckFeature cryptv