aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_normal.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-20 08:16:02 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-15 20:24:43 +0800
commit76b4b1977ba3f3a1f630468a2ce89f47f2cedec4 (patch)
tree7d899e1d86a5e939c231ee18e66f4cea9bd7aa5a /src/nvim/testdir/test_normal.vim
parent37586eac42b285b97e6b85e736750c4f15df068d (diff)
downloadrneovim-76b4b1977ba3f3a1f630468a2ce89f47f2cedec4.tar.gz
rneovim-76b4b1977ba3f3a1f630468a2ce89f47f2cedec4.tar.bz2
rneovim-76b4b1977ba3f3a1f630468a2ce89f47f2cedec4.zip
vim-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 vim/vim#7073) https://github.com/vim/vim/commit/d1ad99b65470d3e754f6a0588a6b0dc2214a1eab Cherry-pick test_registers.vim change from patch 8.2.0644.
Diffstat (limited to 'src/nvim/testdir/test_normal.vim')
-rw-r--r--src/nvim/testdir/test_normal.vim41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim
index 1202f58d8d..f125c860d5 100644
--- a/src/nvim/testdir/test_normal.vim
+++ b/src/nvim/testdir/test_normal.vim
@@ -492,6 +492,18 @@ func Test_normal11_showcmd()
call assert_equal(3, line('$'))
exe "norm! 0d3\<del>2l"
call assert_equal('obar2foobar3', getline('.'))
+ " test for the visual block size displayed in the status line
+ call setline(1, ['aaaaa', 'bbbbb', 'ccccc'])
+ call feedkeys("ggl\<C-V>lljj", 'xt')
+ redraw!
+ call assert_match('3x3$', Screenline(&lines))
+ call feedkeys("\<C-V>", 'xt')
+ " test for visually selecting a multi-byte character
+ call setline(1, ["\U2206"])
+ call feedkeys("ggv", 'xt')
+ redraw!
+ call assert_match('1-3$', Screenline(&lines))
+ call feedkeys("v", 'xt')
bw!
endfunc
@@ -897,6 +909,18 @@ func Test_vert_scroll_cmds()
exe "normal \<C-Y>\<C-Y>"
call assert_equal(h + 1, line('w$'))
+ " Test for CTRL-Y from the first line and CTRL-E from the last line
+ %d
+ set scrolloff=2
+ call setline(1, range(1, 4))
+ exe "normal gg\<C-Y>"
+ call assert_equal(1, line('w0'))
+ call assert_equal(1, line('.'))
+ exe "normal G4\<C-E>\<C-E>"
+ call assert_equal(4, line('w$'))
+ call assert_equal(4, line('.'))
+ set scrolloff&
+
" Using <PageUp> and <PageDown> in an empty buffer should beep
%d
call assert_beeps('exe "normal \<PageUp>"')
@@ -945,6 +969,18 @@ func Test_vert_scroll_cmds()
exe "normal \<C-D>"
call assert_equal(50, line('w0'))
+ " Test for <S-CR>. Page down.
+ %d
+ call setline(1, range(1, 100))
+ call feedkeys("\<S-CR>", 'xt')
+ call assert_equal(14, line('w0'))
+ call assert_equal(28, line('w$'))
+
+ " Test for <S-->. Page up.
+ call feedkeys("\<S-->", 'xt')
+ call assert_equal(1, line('w0'))
+ call assert_equal(15, line('w$'))
+
set foldenable&
close!
endfunc
@@ -1953,7 +1989,7 @@ func Test_normal_section()
close!
endfunc
-" Test for ~ command
+" Test for changing case using u, U, gu, gU and ~ (tilde) commands
func Test_normal30_changecase()
new
call append(0, 'This is a simple test: äüöß')
@@ -1973,6 +2009,9 @@ func Test_normal30_changecase()
call assert_equal('this is a SIMPLE TEST: ÄÜÖSS', getline('.'))
norm! V~
call assert_equal('THIS IS A simple test: äüöss', getline('.'))
+ call assert_beeps('norm! c~')
+ %d
+ call assert_beeps('norm! ~')
" Test for changing case across lines using 'whichwrap'
call setline(1, ['aaaaaa', 'aaaaaa'])