To: vim_dev@googlegroups.com Subject: Patch 8.2.1799 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1799 Problem: Some Normal mode commands not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes #7073) Files: src/testdir/test_gf.vim, src/testdir/test_goto.vim, src/testdir/test_normal.vim, src/testdir/test_registers.vim, src/testdir/test_startup.vim, src/testdir/test_tabpage.vim, src/testdir/test_visual.vim *** ../vim-8.2.1798/src/testdir/test_gf.vim 2020-09-14 19:11:41.698381689 +0200 --- src/testdir/test_gf.vim 2020-10-04 16:14:00.528370482 +0200 *************** *** 183,188 **** --- 183,203 ---- au! InsertCharPre bwipe! + + " gf is not allowed when buffer is locked + new + augroup Test_gf + au! + au OptionSet diff norm! gf + augroup END + call setline(1, ['Xfile1', 'line2', 'line3', 'line4']) + call test_override('starting', 1) + call assert_fails('diffthis', 'E788:') + call test_override('starting', 0) + augroup Test_gf + au! + augroup END + bw! endfunc " If a file is not found by 'gf', then 'includeexpr' should be used to locate *** ../vim-8.2.1798/src/testdir/test_goto.vim 2020-04-28 20:29:04.237851565 +0200 --- src/testdir/test_goto.vim 2020-10-04 16:14:00.528370482 +0200 *************** *** 122,127 **** --- 122,145 ---- call XTest_goto_decl('gd', lines, 3, 14) endfunc + " Using gd to jump to a declaration in a fold + func Test_gd_with_fold() + new + let lines =<< trim END + #define ONE 1 + #define TWO 2 + #define THREE 3 + + TWO + END + call setline(1, lines) + 1,3fold + call feedkeys('Ggd', 'xt') + call assert_equal(2, line('.')) + call assert_equal(-1, foldclosedend(2)) + bw! + endfunc + func Test_gd_not_local() let lines =<< trim [CODE] int func1(void) *** ../vim-8.2.1798/src/testdir/test_normal.vim 2020-10-02 18:48:02.846263669 +0200 --- src/testdir/test_normal.vim 2020-10-04 16:14:00.528370482 +0200 *************** *** 434,439 **** --- 434,451 ---- call assert_equal(3, line('$')) exe "norm! 0d3\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\lljj", 'xt') + redraw! + call assert_match('3x3$', Screenline(&lines)) + call feedkeys("\", '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 *************** *** 838,843 **** --- 850,867 ---- exe "normal \\" 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\" + call assert_equal(1, line('w0')) + call assert_equal(1, line('.')) + exe "normal G4\\" + call assert_equal(4, line('w$')) + call assert_equal(4, line('.')) + set scrolloff& + " Using and in an empty buffer should beep %d call assert_beeps('exe "normal \"') *************** *** 886,891 **** --- 910,927 ---- exe "normal \" call assert_equal(50, line('w0')) + " Test for . Page down. + %d + call setline(1, range(1, 100)) + call feedkeys("\", 'xt') + call assert_equal(14, line('w0')) + call assert_equal(28, line('w$')) + + " Test for . Page up. + call feedkeys("\", 'xt') + call assert_equal(1, line('w0')) + call assert_equal(15, line('w$')) + set foldenable& close! endfunc *************** *** 1856,1862 **** close! endfunc ! " Test for ~ command func Test_normal30_changecase() new call append(0, 'This is a simple test: äüöß') --- 1892,1898 ---- close! endfunc ! " 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: äüöß') *************** *** 1876,1881 **** --- 1912,1920 ---- 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']) *** ../vim-8.2.1798/src/testdir/test_registers.vim 2020-10-02 18:48:02.846263669 +0200 --- src/testdir/test_registers.vim 2020-10-04 16:14:00.528370482 +0200 *************** *** 274,279 **** --- 274,282 ---- call assert_fails('let r = getreg("=", [])', 'E745:') call assert_fails('let r = getreg("=", 1, [])', 'E745:') enew! + + " Using a register in operator-pending mode should fail + call assert_beeps('norm! c"') endfunc func Test_set_register() *** ../vim-8.2.1798/src/testdir/test_startup.vim 2020-08-12 18:50:31.887655765 +0200 --- src/testdir/test_startup.vim 2020-10-04 16:14:00.528370482 +0200 *************** *** 913,919 **** call assert_equal([], readfile('Xtestout')) call delete('Xtestout') endif - call delete('Xafter') endfunc " Test for the "-h" (help) argument --- 913,918 ---- *************** *** 945,951 **** call assert_equal([], readfile('Xtestout')) call delete('Xtestout') endif - call delete('Xafter') endfunc " Test for too many edit argument errors --- 944,949 ---- *** ../vim-8.2.1798/src/testdir/test_tabpage.vim 2020-08-10 19:21:12.163749066 +0200 --- src/testdir/test_tabpage.vim 2020-10-04 16:14:00.528370482 +0200 *************** *** 683,697 **** call assert_equal(3, tabpagenr('$')) " go to tab page 2 in operator-pending mode (should beep) ! call assert_beeps('call feedkeys("f" .. TabLineSelectPageCode(2), "Lx!")') " open new tab page before tab page 1 in operator-pending mode (should beep) ! call assert_beeps('call feedkeys("f" .. TabMenuNewItemCode(1), "Lx!")') " open new tab page after tab page 3 in normal mode call feedkeys(TabMenuNewItemCode(4), "Lx!") call assert_equal(4, tabpagenr()) ! call assert_equal(4, tabpagenr('$')) " go to tab page 2 in insert mode call feedkeys("i" .. TabLineSelectPageCode(2) .. "\", "Lx!") --- 683,701 ---- call assert_equal(3, tabpagenr('$')) " go to tab page 2 in operator-pending mode (should beep) ! call assert_beeps('call feedkeys("c" .. TabLineSelectPageCode(2), "Lx!")') ! call assert_equal(2, tabpagenr()) ! call assert_equal(3, tabpagenr('$')) " open new tab page before tab page 1 in operator-pending mode (should beep) ! call assert_beeps('call feedkeys("c" .. TabMenuNewItemCode(1), "Lx!")') ! call assert_equal(1, tabpagenr()) ! call assert_equal(4, tabpagenr('$')) " open new tab page after tab page 3 in normal mode call feedkeys(TabMenuNewItemCode(4), "Lx!") call assert_equal(4, tabpagenr()) ! call assert_equal(5, tabpagenr('$')) " go to tab page 2 in insert mode call feedkeys("i" .. TabLineSelectPageCode(2) .. "\", "Lx!") *************** *** 699,715 **** " close tab page 2 in insert mode call feedkeys("i" .. TabMenuCloseItemCode(2) .. "\", "Lx!") ! call assert_equal(3, tabpagenr('$')) " open new tab page before tab page 3 in insert mode call feedkeys("i" .. TabMenuNewItemCode(3) .. "\", "Lx!") call assert_equal(3, tabpagenr()) ! call assert_equal(4, tabpagenr('$')) " open new tab page after tab page 4 in insert mode call feedkeys("i" .. TabMenuNewItemCode(5) .. "\", "Lx!") call assert_equal(5, tabpagenr()) ! call assert_equal(5, tabpagenr('$')) %bw! endfunc --- 703,719 ---- " close tab page 2 in insert mode call feedkeys("i" .. TabMenuCloseItemCode(2) .. "\", "Lx!") ! call assert_equal(4, tabpagenr('$')) " open new tab page before tab page 3 in insert mode call feedkeys("i" .. TabMenuNewItemCode(3) .. "\", "Lx!") call assert_equal(3, tabpagenr()) ! call assert_equal(5, tabpagenr('$')) " open new tab page after tab page 4 in insert mode call feedkeys("i" .. TabMenuNewItemCode(5) .. "\", "Lx!") call assert_equal(5, tabpagenr()) ! call assert_equal(6, tabpagenr('$')) %bw! endfunc *** ../vim-8.2.1798/src/testdir/test_visual.vim 2020-10-02 18:48:02.846263669 +0200 --- src/testdir/test_visual.vim 2020-10-04 16:14:00.528370482 +0200 *************** *** 1,5 **** --- 1,7 ---- " Tests for various Visual modes. + source shared.vim + func Test_block_shift_multibyte() " Uses double-wide character. split *************** *** 636,647 **** 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 _ --- 638,643 ---- *************** *** 905,919 **** 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! endfunc " Test for visually selecting an inner block (iB) --- 901,938 ---- close! endfunc ! " 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) *** ../vim-8.2.1798/src/version.c 2020-10-04 16:06:00.513884339 +0200 --- src/version.c 2020-10-04 16:14:29.884278711 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1799, /**/ -- "You know, it's at times like this when I'm trapped in a Vogon airlock with a man from Betelgeuse and about to die of asphyxiation in deep space that I really wish I'd listened to what my mother told me when I was young!" "Why, what did she tell you?" "I don't know, I didn't listen!" -- Arthur Dent and Ford Prefect in Douglas Adams' "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///