comparison src/testdir/test_normal.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 1baf86830e44
comparison
equal deleted inserted replaced
22501:ce527f2034c0 22502:1503ecd54f8a
432 call assert_equal(3, line('$')) 432 call assert_equal(3, line('$'))
433 exe "norm! VAfoobar3\<esc>" 433 exe "norm! VAfoobar3\<esc>"
434 call assert_equal(3, line('$')) 434 call assert_equal(3, line('$'))
435 exe "norm! 0d3\<del>2l" 435 exe "norm! 0d3\<del>2l"
436 call assert_equal('obar2foobar3', getline('.')) 436 call assert_equal('obar2foobar3', getline('.'))
437 " test for the visual block size displayed in the status line
438 call setline(1, ['aaaaa', 'bbbbb', 'ccccc'])
439 call feedkeys("ggl\<C-V>lljj", 'xt')
440 redraw!
441 call assert_match('3x3$', Screenline(&lines))
442 call feedkeys("\<C-V>", 'xt')
443 " test for visually selecting a multi-byte character
444 call setline(1, ["\U2206"])
445 call feedkeys("ggv", 'xt')
446 redraw!
447 call assert_match('1-3$', Screenline(&lines))
448 call feedkeys("v", 'xt')
437 bw! 449 bw!
438 endfunc 450 endfunc
439 451
440 " Test for nv_error and normal command errors 452 " Test for nv_error and normal command errors
441 func Test_normal12_nv_error() 453 func Test_normal12_nv_error()
836 exe h + 5 848 exe h + 5
837 normal z- 849 normal z-
838 exe "normal \<C-Y>\<C-Y>" 850 exe "normal \<C-Y>\<C-Y>"
839 call assert_equal(h + 1, line('w$')) 851 call assert_equal(h + 1, line('w$'))
840 852
853 " Test for CTRL-Y from the first line and CTRL-E from the last line
854 %d
855 set scrolloff=2
856 call setline(1, range(1, 4))
857 exe "normal gg\<C-Y>"
858 call assert_equal(1, line('w0'))
859 call assert_equal(1, line('.'))
860 exe "normal G4\<C-E>\<C-E>"
861 call assert_equal(4, line('w$'))
862 call assert_equal(4, line('.'))
863 set scrolloff&
864
841 " Using <PageUp> and <PageDown> in an empty buffer should beep 865 " Using <PageUp> and <PageDown> in an empty buffer should beep
842 %d 866 %d
843 call assert_beeps('exe "normal \<PageUp>"') 867 call assert_beeps('exe "normal \<PageUp>"')
844 call assert_beeps('exe "normal \<C-B>"') 868 call assert_beeps('exe "normal \<C-B>"')
845 call assert_beeps('exe "normal \<PageDown>"') 869 call assert_beeps('exe "normal \<PageDown>"')
883 call assert_equal(lnum, winline()) 907 call assert_equal(lnum, winline())
884 call assert_equal(50, line('.')) 908 call assert_equal(50, line('.'))
885 normal zt 909 normal zt
886 exe "normal \<C-D>" 910 exe "normal \<C-D>"
887 call assert_equal(50, line('w0')) 911 call assert_equal(50, line('w0'))
912
913 " Test for <S-CR>. Page down.
914 %d
915 call setline(1, range(1, 100))
916 call feedkeys("\<S-CR>", 'xt')
917 call assert_equal(14, line('w0'))
918 call assert_equal(28, line('w$'))
919
920 " Test for <S-->. Page up.
921 call feedkeys("\<S-->", 'xt')
922 call assert_equal(1, line('w0'))
923 call assert_equal(15, line('w$'))
888 924
889 set foldenable& 925 set foldenable&
890 close! 926 close!
891 endfunc 927 endfunc
892 928
1854 call assert_equal(-1, foldclosedend(line('.'))) 1890 call assert_equal(-1, foldclosedend(line('.')))
1855 1891
1856 close! 1892 close!
1857 endfunc 1893 endfunc
1858 1894
1859 " Test for ~ command 1895 " Test for changing case using u, U, gu, gU and ~ (tilde) commands
1860 func Test_normal30_changecase() 1896 func Test_normal30_changecase()
1861 new 1897 new
1862 call append(0, 'This is a simple test: äüöß') 1898 call append(0, 'This is a simple test: äüöß')
1863 norm! 1ggVu 1899 norm! 1ggVu
1864 call assert_equal('this is a simple test: äüöß', getline('.')) 1900 call assert_equal('this is a simple test: äüöß', getline('.'))
1874 call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖSS', getline('.')) 1910 call assert_equal('THIS IS A SIMPLE TEST: ÄÜÖSS', getline('.'))
1875 norm! 010~ 1911 norm! 010~
1876 call assert_equal('this is a SIMPLE TEST: ÄÜÖSS', getline('.')) 1912 call assert_equal('this is a SIMPLE TEST: ÄÜÖSS', getline('.'))
1877 norm! V~ 1913 norm! V~
1878 call assert_equal('THIS IS A simple test: äüöss', getline('.')) 1914 call assert_equal('THIS IS A simple test: äüöss', getline('.'))
1915 call assert_beeps('norm! c~')
1916 %d
1917 call assert_beeps('norm! ~')
1879 1918
1880 " Test for changing case across lines using 'whichwrap' 1919 " Test for changing case across lines using 'whichwrap'
1881 call setline(1, ['aaaaaa', 'aaaaaa']) 1920 call setline(1, ['aaaaaa', 'aaaaaa'])
1882 normal! gg10~ 1921 normal! gg10~
1883 call assert_equal(['AAAAAA', 'aaaaaa'], getline(1, 2)) 1922 call assert_equal(['AAAAAA', 'aaaaaa'], getline(1, 2))