Skip to content

Commit dac1947

Browse files
committed
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)
1 parent dda933d commit dac1947

5 files changed

Lines changed: 30 additions & 12 deletions

File tree

src/testdir/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ nolog:
121121
RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_PLUGIN)
122122

123123
newtests: newtestssilent
124-
@/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then cat messages && cat test.log; fi"
124+
@/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"
125125

126126
newtestssilent: $(NEW_TESTS)
127127

src/testdir/README.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ TO ADD A NEW STYLE TEST:
2020
4) Also add an entry in src/Makefile.
2121

2222
What you can use (see test_assert.vim for an example):
23-
- Call assert_equal(), assert_true() and assert_false().
23+
- Call assert_equal(), assert_true(), assert_false(), etc.
2424
- Use try/catch to check for exceptions.
2525
- Use alloc_fail() to have memory allocation fail. This makes it possible
2626
to check memory allocation failures are handled gracefully. You need to
@@ -29,6 +29,9 @@ What you can use (see test_assert.vim for an example):
2929
- Use disable_char_avail_for_testing(1) if char_avail() must return FALSE for
3030
a while. E.g. to trigger the CursorMovedI autocommand event.
3131
See test_cursor_func.vim for an example
32+
- If the bug that is being tested isn't fixed yet, you can throw an exception
33+
so that it's clear this still needs work. E.g.:
34+
throw "Skipped: Bug with <c-e> and popupmenu not fixed yet"
3235
- See the start of runtest.vim for more help.
3336

3437

src/testdir/runtest.vim

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ function RunTheTest(test)
9696
let s:done += 1
9797
try
9898
exe 'call ' . a:test
99+
catch /^\cskipped/
100+
call add(s:messages, ' Skipped')
101+
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
99102
catch
100103
call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
101104
endtry
@@ -127,6 +130,7 @@ let s:done = 0
127130
let s:fail = 0
128131
let s:errors = []
129132
let s:messages = []
133+
let s:skipped = []
130134
if expand('%') =~ 'test_viml.vim'
131135
" this test has intentional s:errors, don't use try/catch.
132136
source %
@@ -200,7 +204,10 @@ if s:fail > 0
200204
call extend(s:messages, s:errors)
201205
endif
202206

203-
" Append messages to "messages"
207+
" Add SKIPPED messages
208+
call extend(s:messages, s:skipped)
209+
210+
" Append messages to the file "messages"
204211
split messages
205212
call append(line('$'), '')
206213
call append(line('$'), 'From ' . g:testname . ':')

src/testdir/test_popup.vim

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ func! ListMonths()
1616
return ''
1717
endfunc
1818

19+
func! Test_popup_complete2()
20+
" Insert match immediately, if there is only one match
21+
" <c-e> Should select a character from the line below
22+
" TODO: test disabled because the code change has been reverted.
23+
throw "Skipped: Bug with <c-e> and popupmenu not fixed yet"
24+
new
25+
inoremap <f5> <c-r>=ListMonths()<cr>
26+
call append(1, ["December2015"])
27+
:1
28+
call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx')
29+
call assert_equal(["December2015", "", "December2015"], getline(1,3))
30+
%d
31+
bw!
32+
endfu
33+
1934
func! Test_popup_complete()
2035
new
2136
inoremap <f5> <c-r>=ListMonths()<cr>
@@ -168,15 +183,6 @@ func! Test_popup_complete()
168183
call assert_equal(["December2015", "December2015", ""], getline(1,3))
169184
%d
170185

171-
" Insert match immediately, if there is only one match
172-
" <c-e> Should select a character from the line below
173-
" TODO: test disabled because the code change has been reverted.
174-
" call append(1, ["December2015"])
175-
" :1
176-
" call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx')
177-
" call assert_equal(["December2015", "", "December2015"], getline(1,3))
178-
" %d
179-
180186
" use menuone for 'completeopt'
181187
" Since for the first <c-y> the menu is still shown, will only select
182188
" three letters from the line above

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2321,
766768
/**/
767769
2320,
768770
/**/

0 commit comments

Comments
 (0)