To: vim_dev@googlegroups.com Subject: Patch 8.2.0036 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0036 Problem: Not enough test coverage for match functions. Solution: Add a few more test cases. (Dominique Pelle, closes #5394) Add error number. Files: src/testdir/test_match.vim *** ../vim-8.2.0035/src/testdir/test_match.vim 2019-09-01 19:10:10.000000000 +0200 --- src/testdir/test_match.vim 2019-12-24 15:15:12.034571510 +0100 *************** *** 150,155 **** --- 150,170 ---- highlight MyGroup3 NONE endfunc + func Test_match_error() + call assert_fails('match Error', 'E475:') + call assert_fails('match Error /', 'E475:') + call assert_fails('4match Error /x/', 'E476:') + call assert_fails('match Error /x/ x', 'E488:') + endfunc + + func Test_matchadd_error() + call assert_fails("call matchadd('GroupDoesNotExist', 'X')", 'E28:') + call assert_fails("call matchadd('Search', '\\(')", 'E475:') + call assert_fails("call matchadd('Search', 'XXX', 1, 123, 1)", 'E715:') + call assert_fails("call matchadd('Error', 'XXX', 1, 3)", 'E798:') + call assert_fails("call matchadd('Error', 'XXX', 1, 0)", 'E799:') + endfunc + func Test_matchaddpos() syntax on set hlsearch *************** *** 254,259 **** --- 269,285 ---- set hlsearch& endfunc + func Test_matchaddpos_error() + call assert_fails("call matchaddpos('Error', 1)", 'E686:') + call assert_fails("call matchaddpos('Error', [1], 1, 1)", 'E798:') + call assert_fails("call matchaddpos('Error', [1], 1, 2)", 'E798:') + call assert_fails("call matchaddpos('Error', [1], 1, 0)", 'E799:') + call assert_fails("call matchaddpos('Error', [1], 1, 123, 1)", 'E715:') + call assert_fails("call matchaddpos('Error', [1], 1, 5, {'window':12345})", 'E957:') + " Why doesn't the following error have an error code E...? + call assert_fails("call matchaddpos('Error', [{}])", 'E290:') + endfunc + func OtherWindowCommon() let lines =<< trim END call setline(1, 'Hello Vim world') *************** *** 278,283 **** --- 304,314 ---- call delete('XscriptMatchCommon') endfunc + func Test_matchdelete_error() + call assert_fails("call matchdelete(0)", 'E802:') + call assert_fails("call matchdelete(1, -1)", 'E957:') + endfunc + func Test_matchclear_other_window() if !CanRunVimInTerminal() throw 'Skipped: cannot make screendumps' *** ../vim-8.2.0035/src/version.c 2019-12-23 22:59:14.264820697 +0100 --- src/version.c 2019-12-24 15:16:36.446164739 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 36, /**/ -- A real patriot is the fellow who gets a parking ticket and rejoices that the system works. /// 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 ///