To: vim_dev@googlegroups.com Subject: Patch 8.2.2046 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2046 Problem: Some test failures don't give a clear error. Solution: Use assert_match() and assert_fails() instead of assert_true(). (Ken Takata, closes #7368) Files: src/testdir/test_autocmd.vim, src/testdir/test_backspace_opt.vim *** ../vim-8.2.2045/src/testdir/test_autocmd.vim 2020-10-28 20:19:56.376057067 +0100 --- src/testdir/test_autocmd.vim 2020-11-25 14:13:28.122346509 +0100 *************** *** 300,327 **** augroup TheWarning au VimEnter * echo 'entering' augroup END ! call assert_true(match(execute('au VimEnter'), "TheWarning.*VimEnter") >= 0) redir => res augroup! TheWarning redir END ! call assert_true(match(res, "W19:") >= 0) ! call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0) " check "Another" does not take the pace of the deleted entry augroup Another augroup END ! call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0) augroup! Another " no warning for postpone aucmd delete augroup StartOK au VimEnter * call RemoveGroup() augroup END ! call assert_true(match(execute('au VimEnter'), "StartOK.*VimEnter") >= 0) redir => res doautocmd VimEnter redir END ! call assert_true(match(res, "W19:") < 0) au! VimEnter call assert_fails('augroup!', 'E471:') --- 300,327 ---- augroup TheWarning au VimEnter * echo 'entering' augroup END ! call assert_match("TheWarning.*VimEnter", execute('au VimEnter')) redir => res augroup! TheWarning redir END ! call assert_match("W19:", res) ! call assert_match("-Deleted-.*VimEnter", execute('au VimEnter')) " check "Another" does not take the pace of the deleted entry augroup Another augroup END ! call assert_match("-Deleted-.*VimEnter", execute('au VimEnter')) augroup! Another " no warning for postpone aucmd delete augroup StartOK au VimEnter * call RemoveGroup() augroup END ! call assert_match("StartOK.*VimEnter", execute('au VimEnter')) redir => res doautocmd VimEnter redir END ! call assert_notmatch("W19:", res) au! VimEnter call assert_fails('augroup!', 'E471:') *************** *** 351,357 **** au VimEnter * echo augroup end augroup! x ! call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0) au! VimEnter endfunc --- 351,357 ---- au VimEnter * echo augroup end augroup! x ! call assert_match("-Deleted-.*VimEnter", execute('au VimEnter')) au! VimEnter endfunc *** ../vim-8.2.2045/src/testdir/test_backspace_opt.vim 2020-09-04 21:18:40.480161935 +0200 --- src/testdir/test_backspace_opt.vim 2020-11-25 14:13:28.122346509 +0100 *************** *** 1,15 **** " Tests for 'backspace' settings - func Exec(expr) - let str='' - try - exec a:expr - catch /.*/ - let str=v:exception - endtry - return str - endfunc - func Test_backspace_option() set backspace= call assert_equal('', &backspace) --- 1,5 ---- *************** *** 41,50 **** set backspace-=eol call assert_equal('', &backspace) " Check the error ! call assert_equal(0, match(Exec('set backspace=ABC'), '.*E474:')) ! call assert_equal(0, match(Exec('set backspace+=def'), '.*E474:')) " NOTE: Vim doesn't check following error... ! "call assert_equal(0, match(Exec('set backspace-=ghi'), '.*E474:')) " Check backwards compatibility with version 5.4 and earlier set backspace=0 --- 31,40 ---- set backspace-=eol call assert_equal('', &backspace) " Check the error ! call assert_fails('set backspace=ABC', 'E474:') ! call assert_fails('set backspace+=def', 'E474:') " NOTE: Vim doesn't check following error... ! "call assert_fails('set backspace-=ghi', 'E474:') " Check backwards compatibility with version 5.4 and earlier set backspace=0 *************** *** 55,62 **** call assert_equal('2', &backspace) set backspace=3 call assert_equal('3', &backspace) ! call assert_false(match(Exec('set backspace=4'), '.*E474:')) ! call assert_false(match(Exec('set backspace=10'), '.*E474:')) " Cleared when 'compatible' is set set compatible --- 45,52 ---- call assert_equal('2', &backspace) set backspace=3 call assert_equal('3', &backspace) ! call assert_fails('set backspace=4', 'E474:') ! call assert_fails('set backspace=10', 'E474:') " Cleared when 'compatible' is set set compatible *** ../vim-8.2.2045/src/version.c 2020-11-25 13:48:58.884233793 +0100 --- src/version.c 2020-11-25 14:14:36.650101313 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2046, /**/ -- GUARD #1: What -- a swallow carrying a coconut? ARTHUR: It could grip it by the husk! GUARD #1: It's not a question of where he grips it! It's a simple question of weight ratios! A five ounce bird could not carry a 1 pound coconut. The Quest for the Holy Grail (Monty Python) /// 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 ///