Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1,5 +1,7 @@ " Tests for various Visual modes. +source shared.vim + func Test_block_shift_multibyte() " Uses double-wide character. split @@ -636,12 +638,6 @@ func Test_characterwise_visual_mode() normal Gkvj$d call assert_equal(['', 'a', ''], getline(1, '$')) - " characterwise visual mode: use a count with the visual mode - %d _ - call setline(1, 'one two three') - norm! vy5vy - call assert_equal('one t', @") - " characterwise visual mode: use a count with the visual mode from the last " line in the buffer %d _ @@ -905,15 +901,38 @@ func Test_exclusive_selection() close! endfunc -" Test for starting visual mode with a count. -" This test should be run without any previous visual modes. So this should be -" run as a first test. -func Test_AAA_start_visual_mode_with_count() - new - call setline(1, ['aaaaaaa', 'aaaaaaa', 'aaaaaaa', 'aaaaaaa']) - normal! gg2Vy - call assert_equal("aaaaaaa\naaaaaaa\n", @") - close! +" Test for starting linewise visual with a count. +" This test needs to be run without any previous visual mode. Otherwise the +" count will use the count from the previous visual mode. +func Test_linewise_visual_with_count() + let after =<< trim [CODE] + call setline(1, ['one', 'two', 'three', 'four']) + norm! 3Vy + call assert_equal("one\ntwo\nthree\n", @") + call writefile(v:errors, 'Xtestout') + qall! + [CODE] + if RunVim([], after, '') + call assert_equal([], readfile('Xtestout')) + call delete('Xtestout') + endif +endfunc + +" Test for starting characterwise visual with a count. +" This test needs to be run without any previous visual mode. Otherwise the +" count will use the count from the previous visual mode. +func Test_characterwise_visual_with_count() + let after =<< trim [CODE] + call setline(1, ['one two', 'three']) + norm! l5vy + call assert_equal("ne tw", @") + call writefile(v:errors, 'Xtestout') + qall! + [CODE] + if RunVim([], after, '') + call assert_equal([], readfile('Xtestout')) + call delete('Xtestout') + endif endfunc " Test for visually selecting an inner block (iB)