comparison src/testdir/test_quickfix.vim @ 20978:2c3e7a6bd6c6 v8.2.1040

patch 8.2.1040: not enough testing for movement commands Commit: https://github.com/vim/vim/commit/bdd2c290d3cda69e0046c42f0c651f60bc510a16 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jun 22 21:34:30 2020 +0200 patch 8.2.1040: not enough testing for movement commands Problem: Not enough testing for movement commands. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6313)
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Jun 2020 21:45:03 +0200
parents f23c6543a54d
children 6c634e63989c
comparison
equal deleted inserted replaced
20977:6953733825a7 20978:2c3e7a6bd6c6
486 Xfirst 486 Xfirst
487 call assert_fails('-5Xcc', 'E16:') 487 call assert_fails('-5Xcc', 'E16:')
488 call assert_fails('Xprev', 'E553') 488 call assert_fails('Xprev', 'E553')
489 call assert_fails('Xpfile', 'E553') 489 call assert_fails('Xpfile', 'E553')
490 Xnfile 490 Xnfile
491 call assert_equal('Xqftestfile2', bufname('%')) 491 call assert_equal('Xqftestfile2', @%)
492 call assert_equal(10, line('.')) 492 call assert_equal(10, line('.'))
493 Xpfile 493 Xpfile
494 call assert_equal('Xqftestfile1', bufname('%')) 494 call assert_equal('Xqftestfile1', @%)
495 call assert_equal(6, line('.')) 495 call assert_equal(6, line('.'))
496 5Xcc 496 5Xcc
497 call assert_equal(5, g:Xgetlist({'idx':0}).idx) 497 call assert_equal(5, g:Xgetlist({'idx':0}).idx)
498 2Xcc 498 2Xcc
499 call assert_equal(2, g:Xgetlist({'idx':0}).idx) 499 call assert_equal(2, g:Xgetlist({'idx':0}).idx)
505 call assert_equal(2, g:Xgetlist({'idx':0}).idx) 505 call assert_equal(2, g:Xgetlist({'idx':0}).idx)
506 10Xcc 506 10Xcc
507 call assert_equal(6, g:Xgetlist({'idx':0}).idx) 507 call assert_equal(6, g:Xgetlist({'idx':0}).idx)
508 Xlast 508 Xlast
509 Xprev 509 Xprev
510 call assert_equal('Xqftestfile2', bufname('%')) 510 call assert_equal('Xqftestfile2', @%)
511 call assert_equal(11, line('.')) 511 call assert_equal(11, line('.'))
512 call assert_fails('Xnext', 'E553') 512 call assert_fails('Xnext', 'E553')
513 call assert_fails('Xnfile', 'E553') 513 call assert_fails('Xnfile', 'E553')
514 " To process the range using quickfix list entries, directly use the 514 " To process the range using quickfix list entries, directly use the
515 " quickfix commands (don't use the user defined commands) 515 " quickfix commands (don't use the user defined commands)
518 else 518 else
519 $ll 519 $ll
520 endif 520 endif
521 call assert_equal(6, g:Xgetlist({'idx':0}).idx) 521 call assert_equal(6, g:Xgetlist({'idx':0}).idx)
522 Xrewind 522 Xrewind
523 call assert_equal('Xqftestfile1', bufname('%')) 523 call assert_equal('Xqftestfile1', @%)
524 call assert_equal(5, line('.')) 524 call assert_equal(5, line('.'))
525 525
526 10Xnext 526 10Xnext
527 call assert_equal('Xqftestfile2', bufname('%')) 527 call assert_equal('Xqftestfile2', @%)
528 call assert_equal(11, line('.')) 528 call assert_equal(11, line('.'))
529 10Xprev 529 10Xprev
530 call assert_equal('Xqftestfile1', bufname('%')) 530 call assert_equal('Xqftestfile1', @%)
531 call assert_equal(5, line('.')) 531 call assert_equal(5, line('.'))
532 532
533 " Jumping to an error from the error window using cc command 533 " Jumping to an error from the error window using cc command
534 Xgetexpr ['Xqftestfile1:5:Line5', 534 Xgetexpr ['Xqftestfile1:5:Line5',
535 \ 'Xqftestfile1:6:Line6', 535 \ 'Xqftestfile1:6:Line6',
536 \ 'Xqftestfile2:10:Line10', 536 \ 'Xqftestfile2:10:Line10',
537 \ 'Xqftestfile2:11:Line11'] 537 \ 'Xqftestfile2:11:Line11']
538 Xopen 538 Xopen
539 10Xcc 539 10Xcc
540 call assert_equal(11, line('.')) 540 call assert_equal(11, line('.'))
541 call assert_equal('Xqftestfile2', bufname('%')) 541 call assert_equal('Xqftestfile2', @%)
542 Xopen 542 Xopen
543 call cursor(2, 1) 543 call cursor(2, 1)
544 if a:cchar == 'c' 544 if a:cchar == 'c'
545 .cc 545 .cc
546 else 546 else
547 .ll 547 .ll
548 endif 548 endif
549 call assert_equal(6, line('.')) 549 call assert_equal(6, line('.'))
550 call assert_equal('Xqftestfile1', bufname('%')) 550 call assert_equal('Xqftestfile1', @%)
551 551
552 " Jumping to an error from the error window (when only the error window is 552 " Jumping to an error from the error window (when only the error window is
553 " present) 553 " present)
554 Xopen | only 554 Xopen | only
555 Xlast 1 555 Xlast 1
556 call assert_equal(5, line('.')) 556 call assert_equal(5, line('.'))
557 call assert_equal('Xqftestfile1', bufname('%')) 557 call assert_equal('Xqftestfile1', @%)
558 558
559 Xexpr "" 559 Xexpr ""
560 call assert_fails('Xnext', 'E42:') 560 call assert_fails('Xnext', 'E42:')
561 561
562 call delete('Xqftestfile1') 562 call delete('Xqftestfile1')
1857 " current tabpage doesn't have any usable windows, should open it in a new 1857 " current tabpage doesn't have any usable windows, should open it in a new
1858 " window in the current tabpage. 1858 " window in the current tabpage.
1859 copen | only 1859 copen | only
1860 cfirst 1860 cfirst
1861 call assert_equal(1, tabpagenr()) 1861 call assert_equal(1, tabpagenr())
1862 call assert_equal('Xqftestfile1', bufname('')) 1862 call assert_equal('Xqftestfile1', @%)
1863 1863
1864 " If opening a file changes 'switchbuf', then the new value should be 1864 " If opening a file changes 'switchbuf', then the new value should be
1865 " retained. 1865 " retained.
1866 set modeline&vim 1866 set modeline&vim
1867 call writefile(["vim: switchbuf=split"], 'Xqftestfile1') 1867 call writefile(["vim: switchbuf=split"], 'Xqftestfile1')
2677 let bnum = bufnr('') 2677 let bnum = bufnr('')
2678 exe 'sbuffer ' . bnum 2678 exe 'sbuffer ' . bnum
2679 wincmd b 2679 wincmd b
2680 cfirst 2680 cfirst
2681 call assert_equal(2, winnr()) 2681 call assert_equal(2, winnr())
2682 call assert_equal('F1', bufname('')) 2682 call assert_equal('F1', @%)
2683 enew | only 2683 enew | only
2684 exe 'sb' bnum 2684 exe 'sb' bnum
2685 exe 'botright sb' bnum 2685 exe 'botright sb' bnum
2686 wincmd t 2686 wincmd t
2687 clast 2687 clast
2766 call assert_equal('Editor:VIM vim', l[0].text) 2766 call assert_equal('Editor:VIM vim', l[0].text)
2767 2767
2768 edit +3 Xtestfile2 2768 edit +3 Xtestfile2
2769 Xvimgrep +\cemacs+j Xtestfile1 2769 Xvimgrep +\cemacs+j Xtestfile1
2770 let l = g:Xgetlist() 2770 let l = g:Xgetlist()
2771 call assert_equal('Xtestfile2', bufname('')) 2771 call assert_equal('Xtestfile2', @%)
2772 call assert_equal('Editor:Emacs EmAcS', l[0].text) 2772 call assert_equal('Editor:Emacs EmAcS', l[0].text)
2773 2773
2774 " Test for unloading a buffer after vimgrep searched the buffer 2774 " Test for unloading a buffer after vimgrep searched the buffer
2775 %bwipe 2775 %bwipe
2776 Xvimgrep /Editor/j Xtestfile* 2776 Xvimgrep /Editor/j Xtestfile*
3392 3392
3393 call g:Xsetlist([], ' ', {'items' : l}) 3393 call g:Xsetlist([], ' ', {'items' : l})
3394 Xopen | only 3394 Xopen | only
3395 2Xnext 3395 2Xnext
3396 call assert_equal(3, g:Xgetlist({'idx' : 0}).idx) 3396 call assert_equal(3, g:Xgetlist({'idx' : 0}).idx)
3397 call assert_equal('F3', bufname('%')) 3397 call assert_equal('F3', @%)
3398 Xnext 3398 Xnext
3399 call assert_equal(7, col('.')) 3399 call assert_equal(7, col('.'))
3400 Xnext 3400 Xnext
3401 call assert_equal(2, line('.')) 3401 call assert_equal(2, line('.'))
3402 Xnext 3402 Xnext
4041 let l = ['Xtestfile1:2:Line2', 'Xtestfile2:4:Line4'] 4041 let l = ['Xtestfile1:2:Line2', 'Xtestfile2:4:Line4']
4042 4042
4043 " Test for cexpr/lexpr 4043 " Test for cexpr/lexpr
4044 enew 4044 enew
4045 Xexpr l 4045 Xexpr l
4046 call assert_equal('Xtestfile1', bufname('')) 4046 call assert_equal('Xtestfile1', @%)
4047 call assert_equal(2, line('.')) 4047 call assert_equal(2, line('.'))
4048 4048
4049 " Test for cfile/lfile 4049 " Test for cfile/lfile
4050 enew 4050 enew
4051 call writefile(l, 'Xerr') 4051 call writefile(l, 'Xerr')
4052 Xfile Xerr 4052 Xfile Xerr
4053 call assert_equal('Xtestfile1', bufname('')) 4053 call assert_equal('Xtestfile1', @%)
4054 call assert_equal(2, line('.')) 4054 call assert_equal(2, line('.'))
4055 4055
4056 " Test for cbuffer/lbuffer 4056 " Test for cbuffer/lbuffer
4057 edit Xerr 4057 edit Xerr
4058 Xbuffer 4058 Xbuffer
4059 call assert_equal('Xtestfile1', bufname('')) 4059 call assert_equal('Xtestfile1', @%)
4060 call assert_equal(2, line('.')) 4060 call assert_equal(2, line('.'))
4061 4061
4062 call delete('Xerr') 4062 call delete('Xerr')
4063 call delete('Xtestfile1') 4063 call delete('Xtestfile1')
4064 call delete('Xtestfile2') 4064 call delete('Xtestfile2')
4079 call s:create_test_file('Xtestfile2') 4079 call s:create_test_file('Xtestfile2')
4080 Xexpr 'Xtestfile1:2:Line2' 4080 Xexpr 'Xtestfile1:2:Line2'
4081 autocmd QuickFixCmdPost * Xolder 4081 autocmd QuickFixCmdPost * Xolder
4082 call writefile(['Xtestfile2:4:Line4'], 'Xerr') 4082 call writefile(['Xtestfile2:4:Line4'], 'Xerr')
4083 Xfile Xerr 4083 Xfile Xerr
4084 call assert_equal('Xtestfile2', bufname('')) 4084 call assert_equal('Xtestfile2', @%)
4085 call assert_equal(4, line('.')) 4085 call assert_equal(4, line('.'))
4086 autocmd! QuickFixCmdPost 4086 autocmd! QuickFixCmdPost
4087 4087
4088 " Test for cbuffer/lbuffer 4088 " Test for cbuffer/lbuffer
4089 call g:Xsetlist([], 'f') 4089 call g:Xsetlist([], 'f')
4090 Xexpr 'Xtestfile1:2:Line2' 4090 Xexpr 'Xtestfile1:2:Line2'
4091 autocmd QuickFixCmdPost * Xolder 4091 autocmd QuickFixCmdPost * Xolder
4092 call writefile(['Xtestfile2:4:Line4'], 'Xerr') 4092 call writefile(['Xtestfile2:4:Line4'], 'Xerr')
4093 edit Xerr 4093 edit Xerr
4094 Xbuffer 4094 Xbuffer
4095 call assert_equal('Xtestfile2', bufname('')) 4095 call assert_equal('Xtestfile2', @%)
4096 call assert_equal(4, line('.')) 4096 call assert_equal(4, line('.'))
4097 autocmd! QuickFixCmdPost 4097 autocmd! QuickFixCmdPost
4098 4098
4099 " Test for cexpr/lexpr 4099 " Test for cexpr/lexpr
4100 call g:Xsetlist([], 'f') 4100 call g:Xsetlist([], 'f')
4101 Xexpr 'Xtestfile1:2:Line2' 4101 Xexpr 'Xtestfile1:2:Line2'
4102 autocmd QuickFixCmdPost * Xolder 4102 autocmd QuickFixCmdPost * Xolder
4103 Xexpr 'Xtestfile2:4:Line4' 4103 Xexpr 'Xtestfile2:4:Line4'
4104 call assert_equal('Xtestfile2', bufname('')) 4104 call assert_equal('Xtestfile2', @%)
4105 call assert_equal(4, line('.')) 4105 call assert_equal(4, line('.'))
4106 autocmd! QuickFixCmdPost 4106 autocmd! QuickFixCmdPost
4107 4107
4108 " The grepprg may not be set on non-Unix systems 4108 " The grepprg may not be set on non-Unix systems
4109 if has('unix') 4109 if has('unix')
4110 " Test for grep/lgrep 4110 " Test for grep/lgrep
4111 call g:Xsetlist([], 'f') 4111 call g:Xsetlist([], 'f')
4112 Xexpr 'Xtestfile1:2:Line2' 4112 Xexpr 'Xtestfile1:2:Line2'
4113 autocmd QuickFixCmdPost * Xolder 4113 autocmd QuickFixCmdPost * Xolder
4114 silent Xgrep Line5 Xtestfile2 4114 silent Xgrep Line5 Xtestfile2
4115 call assert_equal('Xtestfile2', bufname('')) 4115 call assert_equal('Xtestfile2', @%)
4116 call assert_equal(5, line('.')) 4116 call assert_equal(5, line('.'))
4117 autocmd! QuickFixCmdPost 4117 autocmd! QuickFixCmdPost
4118 endif 4118 endif
4119 4119
4120 " Test for vimgrep/lvimgrep 4120 " Test for vimgrep/lvimgrep
4121 call g:Xsetlist([], 'f') 4121 call g:Xsetlist([], 'f')
4122 Xexpr 'Xtestfile1:2:Line2' 4122 Xexpr 'Xtestfile1:2:Line2'
4123 autocmd QuickFixCmdPost * Xolder 4123 autocmd QuickFixCmdPost * Xolder
4124 silent Xvimgrep Line5 Xtestfile2 4124 silent Xvimgrep Line5 Xtestfile2
4125 call assert_equal('Xtestfile2', bufname('')) 4125 call assert_equal('Xtestfile2', @%)
4126 call assert_equal(5, line('.')) 4126 call assert_equal(5, line('.'))
4127 autocmd! QuickFixCmdPost 4127 autocmd! QuickFixCmdPost
4128 4128
4129 " Test for autocommands clearing the quickfix list before jumping to the 4129 " Test for autocommands clearing the quickfix list before jumping to the
4130 " first error. This should not result in an error 4130 " first error. This should not result in an error
4413 call assert_equal(loclistid, getloclist(0, {'id' : 0}).id) 4413 call assert_equal(loclistid, getloclist(0, {'id' : 0}).id)
4414 " Jump to an entry in the location list and make sure that the cursor is 4414 " Jump to an entry in the location list and make sure that the cursor is
4415 " positioned correctly. 4415 " positioned correctly.
4416 ll 3 4416 ll 3
4417 call assert_equal(loclistid, getloclist(0, {'id' : 0}).id) 4417 call assert_equal(loclistid, getloclist(0, {'id' : 0}).id)
4418 call assert_equal('Xtest1', bufname('')) 4418 call assert_equal('Xtest1', @%)
4419 call assert_equal(15, line('.')) 4419 call assert_equal(15, line('.'))
4420 " Cleanup 4420 " Cleanup
4421 autocmd! WinEnter 4421 autocmd! WinEnter
4422 new | only 4422 new | only
4423 call delete('Xtest1') 4423 call delete('Xtest1')
4474 4474
4475 " Test the commands with various arguments 4475 " Test the commands with various arguments
4476 Xexpr ["X1:5:3:L5", "X2:5:2:L5", "X2:10:3:L10", "X2:15:4:L15", "X3:3:5:L3"] 4476 Xexpr ["X1:5:3:L5", "X2:5:2:L5", "X2:10:3:L10", "X2:15:4:L15", "X3:3:5:L3"]
4477 edit +7 X2 4477 edit +7 X2
4478 Xabove 4478 Xabove
4479 call assert_equal(['X2', 5], [bufname(''), line('.')]) 4479 call assert_equal(['X2', 5], [@%, line('.')])
4480 call assert_fails('Xabove', 'E553:') 4480 call assert_fails('Xabove', 'E553:')
4481 normal 7G 4481 normal 7G
4482 Xbefore 4482 Xbefore
4483 call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')]) 4483 call assert_equal(['X2', 5, 2], [@%, line('.'), col('.')])
4484 call assert_fails('Xbefore', 'E553:') 4484 call assert_fails('Xbefore', 'E553:')
4485 4485
4486 normal 2j 4486 normal 2j
4487 Xbelow 4487 Xbelow
4488 call assert_equal(['X2', 10], [bufname(''), line('.')]) 4488 call assert_equal(['X2', 10], [@%, line('.')])
4489 normal 7G 4489 normal 7G
4490 Xafter 4490 Xafter
4491 call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')]) 4491 call assert_equal(['X2', 10, 3], [@%, line('.'), col('.')])
4492 4492
4493 " Last error in this file 4493 " Last error in this file
4494 Xbelow 99 4494 Xbelow 99
4495 call assert_equal(['X2', 15], [bufname(''), line('.')]) 4495 call assert_equal(['X2', 15], [@%, line('.')])
4496 call assert_fails('Xbelow', 'E553:') 4496 call assert_fails('Xbelow', 'E553:')
4497 normal gg 4497 normal gg
4498 Xafter 99 4498 Xafter 99
4499 call assert_equal(['X2', 15, 4], [bufname(''), line('.'), col('.')]) 4499 call assert_equal(['X2', 15, 4], [@%, line('.'), col('.')])
4500 call assert_fails('Xafter', 'E553:') 4500 call assert_fails('Xafter', 'E553:')
4501 4501
4502 " First error in this file 4502 " First error in this file
4503 Xabove 99 4503 Xabove 99
4504 call assert_equal(['X2', 5], [bufname(''), line('.')]) 4504 call assert_equal(['X2', 5], [@%, line('.')])
4505 call assert_fails('Xabove', 'E553:') 4505 call assert_fails('Xabove', 'E553:')
4506 normal G 4506 normal G
4507 Xbefore 99 4507 Xbefore 99
4508 call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')]) 4508 call assert_equal(['X2', 5, 2], [@%, line('.'), col('.')])
4509 call assert_fails('Xbefore', 'E553:') 4509 call assert_fails('Xbefore', 'E553:')
4510 4510
4511 normal gg 4511 normal gg
4512 Xbelow 2 4512 Xbelow 2
4513 call assert_equal(['X2', 10], [bufname(''), line('.')]) 4513 call assert_equal(['X2', 10], [@%, line('.')])
4514 normal gg 4514 normal gg
4515 Xafter 2 4515 Xafter 2
4516 call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')]) 4516 call assert_equal(['X2', 10, 3], [@%, line('.'), col('.')])
4517 4517
4518 normal G 4518 normal G
4519 Xabove 2 4519 Xabove 2
4520 call assert_equal(['X2', 10], [bufname(''), line('.')]) 4520 call assert_equal(['X2', 10], [@%, line('.')])
4521 normal G 4521 normal G
4522 Xbefore 2 4522 Xbefore 2
4523 call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')]) 4523 call assert_equal(['X2', 10, 3], [@%, line('.'), col('.')])
4524 4524
4525 edit X4 4525 edit X4
4526 call assert_fails('Xabove', 'E42:') 4526 call assert_fails('Xabove', 'E42:')
4527 call assert_fails('Xbelow', 'E42:') 4527 call assert_fails('Xbelow', 'E42:')
4528 call assert_fails('Xbefore', 'E42:') 4528 call assert_fails('Xbefore', 'E42:')
4542 Xexpr ["X1:5:L5", "X2:5:1:L5_1", "X2:5:2:L5_2", "X2:5:3:L5_3", 4542 Xexpr ["X1:5:L5", "X2:5:1:L5_1", "X2:5:2:L5_2", "X2:5:3:L5_3",
4543 \ "X2:10:1:L10_1", "X2:10:2:L10_2", "X2:10:3:L10_3", 4543 \ "X2:10:1:L10_1", "X2:10:2:L10_2", "X2:10:3:L10_3",
4544 \ "X2:15:1:L15_1", "X2:15:2:L15_2", "X2:15:3:L15_3", "X3:3:L3"] 4544 \ "X2:15:1:L15_1", "X2:15:2:L15_2", "X2:15:3:L15_3", "X3:3:L3"]
4545 edit +1 X2 4545 edit +1 X2
4546 Xbelow 2 4546 Xbelow 2
4547 call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')]) 4547 call assert_equal(['X2', 10, 1], [@%, line('.'), col('.')])
4548 normal 1G 4548 normal 1G
4549 Xafter 2 4549 Xafter 2
4550 call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')]) 4550 call assert_equal(['X2', 5, 2], [@%, line('.'), col('.')])
4551 4551
4552 normal gg 4552 normal gg
4553 Xbelow 99 4553 Xbelow 99
4554 call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')]) 4554 call assert_equal(['X2', 15, 1], [@%, line('.'), col('.')])
4555 normal gg 4555 normal gg
4556 Xafter 99 4556 Xafter 99
4557 call assert_equal(['X2', 15, 3], [bufname(''), line('.'), col('.')]) 4557 call assert_equal(['X2', 15, 3], [@%, line('.'), col('.')])
4558 4558
4559 normal G 4559 normal G
4560 Xabove 2 4560 Xabove 2
4561 call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')]) 4561 call assert_equal(['X2', 10, 1], [@%, line('.'), col('.')])
4562 normal G 4562 normal G
4563 Xbefore 2 4563 Xbefore 2
4564 call assert_equal(['X2', 15, 2], [bufname(''), line('.'), col('.')]) 4564 call assert_equal(['X2', 15, 2], [@%, line('.'), col('.')])
4565 4565
4566 normal G 4566 normal G
4567 Xabove 99 4567 Xabove 99
4568 call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')]) 4568 call assert_equal(['X2', 5, 1], [@%, line('.'), col('.')])
4569 normal G 4569 normal G
4570 Xbefore 99 4570 Xbefore 99
4571 call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')]) 4571 call assert_equal(['X2', 5, 1], [@%, line('.'), col('.')])
4572 4572
4573 normal 10G 4573 normal 10G
4574 Xabove 4574 Xabove
4575 call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')]) 4575 call assert_equal(['X2', 5, 1], [@%, line('.'), col('.')])
4576 normal 10G$ 4576 normal 10G$
4577 2Xbefore 4577 2Xbefore
4578 call assert_equal(['X2', 10, 2], [bufname(''), line('.'), col('.')]) 4578 call assert_equal(['X2', 10, 2], [@%, line('.'), col('.')])
4579 4579
4580 normal 10G 4580 normal 10G
4581 Xbelow 4581 Xbelow
4582 call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')]) 4582 call assert_equal(['X2', 15, 1], [@%, line('.'), col('.')])
4583 normal 9G 4583 normal 9G
4584 5Xafter 4584 5Xafter
4585 call assert_equal(['X2', 15, 2], [bufname(''), line('.'), col('.')]) 4585 call assert_equal(['X2', 15, 2], [@%, line('.'), col('.')])
4586 4586
4587 " Invalid range 4587 " Invalid range
4588 if a:cchar == 'c' 4588 if a:cchar == 'c'
4589 call assert_fails('-2cbelow', 'E16:') 4589 call assert_fails('-2cbelow', 'E16:')
4590 call assert_fails('-2cafter', 'E16:') 4590 call assert_fails('-2cafter', 'E16:')