Skip to content

Commit a7f6c3c

Browse files
committed
patch 8.1.2087: cannot easily select one test function to execute
Problem: Cannot easily select one test function to execute. Solution: Support the $TEST_FILTER environment variable. (Ozaki Kiichi, closes #2695)
1 parent 38f1eea commit a7f6c3c

4 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,6 +2262,10 @@ test1 \
22622262

22632263
# Run individual NEW style test.
22642264
# These do not depend on the executable, compile it when needed.
2265+
# Set $TEST_FILTER to select what test function to invoke, e.g.:
2266+
# export TEST_FILTER=Test_terminal_wipe_buffer
2267+
# A partial match also works:
2268+
# export TEST_FILTER=wipe_buffer
22652269
$(NEW_TESTS):
22662270
cd testdir; $(MAKE) $@ VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
22672271

src/testdir/runtest.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,12 @@ if argc() > 1
384384
let s:tests = filter(s:tests, 'v:val =~ argv(1)')
385385
endif
386386

387+
" If the environment variable $TEST_FILTER is set then filter the function
388+
" names against it.
389+
if $TEST_FILTER != ''
390+
let s:tests = filter(s:tests, 'v:val =~ $TEST_FILTER')
391+
endif
392+
387393
" Execute the tests in alphabetical order.
388394
for s:test in sort(s:tests)
389395
" Silence, please!

src/testdir/summarize.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if 1
88
let g:failed += a:match+0
99
elseif a:type ==# 'skipped'
1010
let g:skipped += 1
11-
call extend(g:skipped_output, ["\t".a:match])
11+
call extend(g:skipped_output, ["\t" .. a:match])
1212
endif
1313
endfunc
1414

@@ -19,6 +19,10 @@ if 1
1919
let g:failed_output = []
2020
let output = [""]
2121

22+
if $TEST_FILTER != ''
23+
call extend(g:skipped_output, ["\tAll tests not matching $TEST_FILTER: '" .. $TEST_FILTER .. "'"])
24+
endif
25+
2226
try
2327
" This uses the :s command to just fetch and process the output of the
2428
" tests, it doesn't actually replace anything.

src/version.c

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

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
2087,
760762
/**/
761763
2086,
762764
/**/

0 commit comments

Comments
 (0)