To: vim_dev@googlegroups.com Subject: Patch 7.4.2321 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) Files: src/testdir/Makefile, src/testdir/runtest.vim, src/testdir/test_popup.vim, src/testdir/README.txt *** ../vim-7.4.2320/src/testdir/Makefile 2016-08-06 19:01:33.984856713 +0200 --- src/testdir/Makefile 2016-09-03 22:15:59.306161546 +0200 *************** *** 121,127 **** RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_PLUGIN) newtests: newtestssilent ! @/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then cat messages && cat test.log; fi" newtestssilent: $(NEW_TESTS) --- 121,127 ---- RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_PLUGIN) newtests: newtestssilent ! @/bin/sh -c "if test -f messages && grep -q 'SKIPPED\|FAILED' messages; then cat messages && if test -f test.log; then cat test.log; fi ; fi" newtestssilent: $(NEW_TESTS) *** ../vim-7.4.2320/src/testdir/runtest.vim 2016-08-24 21:21:22.572601394 +0200 --- src/testdir/runtest.vim 2016-09-03 22:33:29.841219608 +0200 *************** *** 96,101 **** --- 96,104 ---- let s:done += 1 try exe 'call ' . a:test + catch /^\cskipped/ + call add(s:messages, ' Skipped') + call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', '')) catch call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) endtry *************** *** 127,132 **** --- 130,136 ---- let s:fail = 0 let s:errors = [] let s:messages = [] + let s:skipped = [] if expand('%') =~ 'test_viml.vim' " this test has intentional s:errors, don't use try/catch. source % *************** *** 200,206 **** call extend(s:messages, s:errors) endif ! " Append messages to "messages" split messages call append(line('$'), '') call append(line('$'), 'From ' . g:testname . ':') --- 204,213 ---- call extend(s:messages, s:errors) endif ! " Add SKIPPED messages ! call extend(s:messages, s:skipped) ! ! " Append messages to the file "messages" split messages call append(line('$'), '') call append(line('$'), 'From ' . g:testname . ':') *** ../vim-7.4.2320/src/testdir/test_popup.vim 2016-08-09 21:51:36.154407615 +0200 --- src/testdir/test_popup.vim 2016-09-03 22:13:57.043178536 +0200 *************** *** 16,21 **** --- 16,36 ---- return '' endfunc + func! Test_popup_complete2() + " Insert match immediately, if there is only one match + " Should select a character from the line below + " TODO: test disabled because the code change has been reverted. + throw "Skipped: Bug with and popupmenu not fixed yet" + new + inoremap =ListMonths() + call append(1, ["December2015"]) + :1 + call feedkeys("aD\\\\\\\", 'tx') + call assert_equal(["December2015", "", "December2015"], getline(1,3)) + %d + bw! + endfu + func! Test_popup_complete() new inoremap =ListMonths() *************** *** 168,182 **** call assert_equal(["December2015", "December2015", ""], getline(1,3)) %d - " Insert match immediately, if there is only one match - " Should select a character from the line below - " TODO: test disabled because the code change has been reverted. - " call append(1, ["December2015"]) - " :1 - " call feedkeys("aD\\\\\\\", 'tx') - " call assert_equal(["December2015", "", "December2015"], getline(1,3)) - " %d - " use menuone for 'completeopt' " Since for the first the menu is still shown, will only select " three letters from the line above --- 183,188 ---- *** ../vim-7.4.2320/src/testdir/README.txt 2016-08-18 23:04:44.658592849 +0200 --- src/testdir/README.txt 2016-09-03 22:32:37.597666422 +0200 *************** *** 20,26 **** 4) Also add an entry in src/Makefile. What you can use (see test_assert.vim for an example): ! - Call assert_equal(), assert_true() and assert_false(). - Use try/catch to check for exceptions. - Use alloc_fail() to have memory allocation fail. This makes it possible to check memory allocation failures are handled gracefully. You need to --- 20,26 ---- 4) Also add an entry in src/Makefile. What you can use (see test_assert.vim for an example): ! - Call assert_equal(), assert_true(), assert_false(), etc. - Use try/catch to check for exceptions. - Use alloc_fail() to have memory allocation fail. This makes it possible to check memory allocation failures are handled gracefully. You need to *************** *** 29,34 **** --- 29,37 ---- - Use disable_char_avail_for_testing(1) if char_avail() must return FALSE for a while. E.g. to trigger the CursorMovedI autocommand event. See test_cursor_func.vim for an example + - If the bug that is being tested isn't fixed yet, you can throw an exception + so that it's clear this still needs work. E.g.: + throw "Skipped: Bug with and popupmenu not fixed yet" - See the start of runtest.vim for more help. *** ../vim-7.4.2320/src/version.c 2016-09-03 21:04:54.997247322 +0200 --- src/version.c 2016-09-03 22:15:39.250329757 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2321, /**/ -- hundred-and-one symptoms of being an internet addict: 159. You get excited whenever discussing your hard drive. /// 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 ///