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)
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 0d53a75..dd71745 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -384,6 +384,12 @@
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 5bbf0b3..9cf3f69 100644
--- a/src/testdir/summarize.vim
+++ b/src/testdir/summarize.vim
@@ -8,7 +8,7 @@
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 @@
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.