comparison src/testdir/test_virtualedit.vim @ 18791:f966b20bb74d v8.1.2384

patch 8.1.2384: test 48 is old style Commit: https://github.com/vim/vim/commit/079119babe1cbba3f9234927e62fd75465f2d6b4 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 3 22:59:23 2019 +0100 patch 8.1.2384: test 48 is old style Problem: Test 48 is old style. Solution: Merge test cases into new style test. (Yegappan Lakshmanan, closes #5307)
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 Dec 2019 23:00:07 +0100
parents 7b57a80f70f6
children 9c15be376631
comparison
equal deleted inserted replaced
18790:8dde7ced3344 18791:f966b20bb74d
208 208
209 bwipe! 209 bwipe!
210 set virtualedit= 210 set virtualedit=
211 endfunc 211 endfunc
212 212
213 " Insert "keyword keyw", ESC, C CTRL-N, shows "keyword ykeyword".
214 " Repeating CTRL-N fixes it. (Mary Ellen Foster)
215 func Test_ve_completion()
216 new
217 set completeopt&vim
218 set virtualedit=all
219 exe "normal ikeyword keyw\<Esc>C\<C-N>"
220 call assert_equal('keyword keyword', getline(1))
221 bwipe!
222 set virtualedit=
223 endfunc
224
225 " Using "C" then then <CR> moves the last remaining character to the next
226 " line. (Mary Ellen Foster)
227 func Test_ve_del_to_eol()
228 new
229 set virtualedit=all
230 call append(0, 'all your base are belong to us')
231 call search('are', 'w')
232 exe "normal C\<CR>are belong to vim"
233 call assert_equal(['all your base ', 'are belong to vim'], getline(1, 2))
234 bwipe!
235 set virtualedit=
236 endfunc
237
238 " When past the end of a line that ends in a single character "b" skips
239 " that word.
240 func Test_ve_b_past_eol()
241 new
242 set virtualedit=all
243 call append(0, '1 2 3 4 5 6')
244 normal gg^$15lbC7
245 call assert_equal('1 2 3 4 5 7', getline(1))
246 bwipe!
247 set virtualedit=
248 endfunc
249
250 " Make sure 'i', 'C', 'a', 'A' and 'D' works
251 func Test_ve_ins_del()
252 new
253 set virtualedit=all
254 call append(0, ["'i'", "'C'", "'a'", "'A'", "'D'"])
255 call cursor(1, 1)
256 normal $4lix
257 call assert_equal("'i' x", getline(1))
258 call cursor(2, 1)
259 normal $4lCx
260 call assert_equal("'C' x", getline(2))
261 call cursor(3, 1)
262 normal $4lax
263 call assert_equal("'a' x", getline(3))
264 call cursor(4, 1)
265 normal $4lAx
266 call assert_equal("'A'x", getline(4))
267 call cursor(5, 1)
268 normal $4lDix
269 call assert_equal("'D' x", getline(5))
270 bwipe!
271 set virtualedit=
272 endfunc
273
274 " Test for yank bug reported by Mark Waggoner.
275 func Test_yank_block()
276 new
277 set virtualedit=block
278 call append(0, repeat(['this is a test'], 3))
279 exe "normal gg^2w\<C-V>3jy"
280 call assert_equal("a\na\na\n ", @")
281 bwipe!
282 set virtualedit=
283 endfunc
284
285 " Test "r" beyond the end of the line
286 func Test_replace_after_eol()
287 new
288 set virtualedit=all
289 call append(0, '"r"')
290 normal gg$5lrxa
291 call assert_equal('"r" x', getline(1))
292 bwipe!
293 set virtualedit=
294 endfunc
295
296 " Test "r" on a tab
297 " Note that for this test, 'ts' must be 8 (the default).
298 func Test_replace_on_tab()
299 new
300 set virtualedit=all
301 call append(0, "'r'\t")
302 normal gg^5lrxAy
303 call assert_equal("'r' x y", getline(1))
304 bwipe!
305 set virtualedit=
306 endfunc
307
308 " Test to make sure 'x' can delete control characters
309 func Test_ve_del_ctrl_chars()
310 new
311 set virtualedit=all
312 call append(0, "a\<C-V>b\<CR>sd")
313 set display=uhex
314 normal gg^xxxxxxi[text]
315 set display=
316 call assert_equal('[text]', getline(1))
317 bwipe!
318 set virtualedit=
319 endfunc
320
321 " Test for ^Y/^E due to bad w_virtcol value, reported by
322 " Roy <royl@netropolis.net>.
323 func Test_ins_copy_char()
324 new
325 set virtualedit=all
326 call append(0, 'abcv8efi.him2kl')
327 exe "normal gg^O\<Esc>3li\<C-E>\<Esc>4li\<C-E>\<Esc>4li\<C-E> <--"
328 exe "normal j^o\<Esc>4li\<C-Y>\<Esc>4li\<C-Y>\<Esc>4li\<C-Y> <--"
329 call assert_equal(' v i m <--', getline(1))
330 call assert_equal(' 8 . 2 <--', getline(3))
331 bwipe!
332 set virtualedit=
333 endfunc
334
335 " Test for yanking and pasting using the small delete register
336 func Test_yank_paste_small_del_reg()
337 new
338 set virtualedit=all
339 call append(0, "foo, bar")
340 normal ggdewve"-p
341 call assert_equal(', foo', getline(1))
342 bwipe!
343 set virtualedit=
344 endfunc
345
213 " vim: shiftwidth=2 sts=2 expandtab 346 " vim: shiftwidth=2 sts=2 expandtab