comparison src/testdir/test_visual.vim @ 22502:1503ecd54f8a v8.2.1799

patch 8.2.1799: some Normal mode commands not fully tested Commit: https://github.com/vim/vim/commit/d1ad99b65470d3e754f6a0588a6b0dc2214a1eab Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 4 16:16:54 2020 +0200 patch 8.2.1799: some Normal mode commands not fully tested Problem: Some Normal mode commands not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/7073)
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Oct 2020 16:30:03 +0200
parents b3751f4d3b26
children 3cdbce5ba73f
comparison
equal deleted inserted replaced
22501:ce527f2034c0 22502:1503ecd54f8a
1 " Tests for various Visual modes. 1 " Tests for various Visual modes.
2
3 source shared.vim
2 4
3 func Test_block_shift_multibyte() 5 func Test_block_shift_multibyte()
4 " Uses double-wide character. 6 " Uses double-wide character.
5 split 7 split
6 call setline(1, ['xヹxxx', 'ヹxxx']) 8 call setline(1, ['xヹxxx', 'ヹxxx'])
634 call deletebufline('', 1, '$') 636 call deletebufline('', 1, '$')
635 call append('$', ['a', 'b', 'c']) 637 call append('$', ['a', 'b', 'c'])
636 normal Gkvj$d 638 normal Gkvj$d
637 call assert_equal(['', 'a', ''], getline(1, '$')) 639 call assert_equal(['', 'a', ''], getline(1, '$'))
638 640
639 " characterwise visual mode: use a count with the visual mode
640 %d _
641 call setline(1, 'one two three')
642 norm! vy5vy
643 call assert_equal('one t', @")
644
645 " characterwise visual mode: use a count with the visual mode from the last 641 " characterwise visual mode: use a count with the visual mode from the last
646 " line in the buffer 642 " line in the buffer
647 %d _ 643 %d _
648 call setline(1, ['one', 'two', 'three', 'four']) 644 call setline(1, ['one', 'two', 'three', 'four'])
649 norm! vj$y 645 norm! vj$y
903 set virtualedit& 899 set virtualedit&
904 set selection& 900 set selection&
905 close! 901 close!
906 endfunc 902 endfunc
907 903
908 " Test for starting visual mode with a count. 904 " Test for starting linewise visual with a count.
909 " This test should be run without any previous visual modes. So this should be 905 " This test needs to be run without any previous visual mode. Otherwise the
910 " run as a first test. 906 " count will use the count from the previous visual mode.
911 func Test_AAA_start_visual_mode_with_count() 907 func Test_linewise_visual_with_count()
912 new 908 let after =<< trim [CODE]
913 call setline(1, ['aaaaaaa', 'aaaaaaa', 'aaaaaaa', 'aaaaaaa']) 909 call setline(1, ['one', 'two', 'three', 'four'])
914 normal! gg2Vy 910 norm! 3Vy
915 call assert_equal("aaaaaaa\naaaaaaa\n", @") 911 call assert_equal("one\ntwo\nthree\n", @")
916 close! 912 call writefile(v:errors, 'Xtestout')
913 qall!
914 [CODE]
915 if RunVim([], after, '')
916 call assert_equal([], readfile('Xtestout'))
917 call delete('Xtestout')
918 endif
919 endfunc
920
921 " Test for starting characterwise visual with a count.
922 " This test needs to be run without any previous visual mode. Otherwise the
923 " count will use the count from the previous visual mode.
924 func Test_characterwise_visual_with_count()
925 let after =<< trim [CODE]
926 call setline(1, ['one two', 'three'])
927 norm! l5vy
928 call assert_equal("ne tw", @")
929 call writefile(v:errors, 'Xtestout')
930 qall!
931 [CODE]
932 if RunVim([], after, '')
933 call assert_equal([], readfile('Xtestout'))
934 call delete('Xtestout')
935 endif
917 endfunc 936 endfunc
918 937
919 " Test for visually selecting an inner block (iB) 938 " Test for visually selecting an inner block (iB)
920 func Test_visual_inner_block() 939 func Test_visual_inner_block()
921 new 940 new