summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-27 15:34:16 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-27 15:34:16 +0200
commita7f6c3cf071bb6267e0bd2eb3d27ca240381ba87 (patch)
treec0605ca553ec25907e3a6ddca6f5de1e425ef312
parent38f1eeac3d8ec0a0e275213a62ba7ff1afb8ab33 (diff)
downloadvim-git-8.1.2087.tar.gz
patch 8.1.2087: cannot easily select one test function to executev8.1.2087
Problem: Cannot easily select one test function to execute. Solution: Support the $TEST_FILTER environment variable. (Ozaki Kiichi, closes #2695)
-rw-r--r--src/Makefile4
-rw-r--r--src/testdir/runtest.vim6
-rw-r--r--src/testdir/summarize.vim6
-rw-r--r--src/version.c2
4 files changed, 17 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile
index 75085ee4b..6e676f170 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2262,6 +2262,10 @@ test1 \
# Run individual NEW style test.
# These do not depend on the executable, compile it when needed.
+# Set $TEST_FILTER to select what test function to invoke, e.g.:
+# export TEST_FILTER=Test_terminal_wipe_buffer
+# A partial match also works:
+# export TEST_FILTER=wipe_buffer
$(NEW_TESTS):
cd testdir; $(MAKE) $@ VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 0d53a754a..dd717450e 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -384,6 +384,12 @@ if argc() > 1
let s:tests = filter(s:tests, 'v:val =~ argv(1)')
endif
+" If the environment variable $TEST_FILTER is set then filter the function
+" names against it.
+if $TEST_FILTER != ''
+ let s:tests = filter(s:tests, 'v:val =~ $TEST_FILTER')
+endif
+
" Execute the tests in alphabetical order.
for s:test in sort(s:tests)
" Silence, please!
diff --git a/src/testdir/summarize.vim b/src/testdir/summarize.vim
index 5bbf0b338..9cf3f694c 100644
--- a/src/testdir/summarize.vim
+++ b/src/testdir/summarize.vim
@@ -8,7 +8,7 @@ if 1
let g:failed += a:match+0
elseif a:type ==# 'skipped'
let g:skipped += 1
- call extend(g:skipped_output, ["\t".a:match])
+ call extend(g:skipped_output, ["\t" .. a:match])
endif
endfunc
@@ -19,6 +19,10 @@ if 1
let g:failed_output = []
let output = [""]
+ if $TEST_FILTER != ''
+ call extend(g:skipped_output, ["\tAll tests not matching $TEST_FILTER: '" .. $TEST_FILTER .. "'"])
+ endif
+
try
" This uses the :s command to just fetch and process the output of the
" tests, it doesn't actually replace anything.
diff --git a/src/version.c b/src/version.c
index f08e5e0b9..0776a8a6d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2087,
+/**/
2086,
/**/
2085,