To: vim_dev@googlegroups.com Subject: Patch 8.1.2367 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2367 Problem: Registers are not sufficiently tested. Solution: Add a few more test cases. (Yegappan Lakshmanan, closes #5288) Files: src/testdir/test_registers.vim *** ../vim-8.1.2366/src/testdir/test_registers.vim 2019-10-24 20:16:56.117110116 +0200 --- src/testdir/test_registers.vim 2019-11-30 19:46:26.107152765 +0100 *************** *** 1,3 **** --- 1,16 ---- + " + " Tests for register operations + " + + " This test must be executed first to check for empty and unset registers. + func Test_aaa_empty_reg_test() + call assert_fails('normal @@', 'E748:') + call assert_fails('normal @%', 'E354:') + call assert_fails('normal @#', 'E354:') + call assert_fails('normal @!', 'E354:') + call assert_fails('normal @:', 'E30:') + call assert_fails('normal @.', 'E29:') + endfunc func Test_yank_shows_register() enew *************** *** 167,169 **** --- 180,255 ---- set t_F2= endif endfunc + + " Test for executing the last used register (@) + func Test_last_used_exec_reg() + " Test for the @: command + let a = '' + call feedkeys(":let a ..= 'Vim'\", 'xt') + normal @: + call assert_equal('VimVim', a) + + " Test for the @= command + let x = '' + let a = ":let x ..= 'Vim'\" + exe "normal @=a\" + normal @@ + call assert_equal('VimVim', x) + + " Test for the @. command + let a = '' + call feedkeys("i:let a ..= 'Edit'\", 'xt') + normal @. + normal @@ + call assert_equal('EditEdit', a) + + enew! + endfunc + + func Test_get_register() + enew + edit Xfile1 + edit Xfile2 + call assert_equal('Xfile2', getreg('%')) + call assert_equal('Xfile1', getreg('#')) + + call feedkeys("iTwo\", 'xt') + call assert_equal('Two', getreg('.')) + call assert_equal('', getreg('_')) + call assert_beeps('normal ":yy') + call assert_beeps('normal "%yy') + call assert_beeps('normal ".yy') + + call assert_equal('', getreg("\")) + call assert_equal('', getreg("\")) + call assert_equal('', getreg("\")) + + call assert_equal('', getregtype('!')) + + enew! + endfunc + + func Test_set_register() + call assert_fails("call setreg('#', 200)", 'E86:') + + edit Xfile_alt_1 + let b1 = bufnr('') + edit Xfile_alt_2 + let b2 = bufnr('') + edit Xfile_alt_3 + let b3 = bufnr('') + call setreg('#', 'alt_1') + call assert_equal('Xfile_alt_1', getreg('#')) + call setreg('#', b2) + call assert_equal('Xfile_alt_2', getreg('#')) + + let ab = 'regwrite' + call setreg('=', '') + call setreg('=', 'a', 'a') + call setreg('=', 'b', 'a') + call assert_equal('regwrite', getreg('=')) + + enew! + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.1.2366/src/version.c 2019-11-30 19:44:34.851518161 +0100 --- src/version.c 2019-11-30 19:48:14.806773748 +0100 *************** *** 739,740 **** --- 739,742 ---- { /* Add new patch number below this line */ + /**/ + 2367, /**/ -- hundred-and-one symptoms of being an internet addict: 151. You find yourself engaged to someone you've never actually met, except through e-mail. /// 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 ///