]> granicus.if.org Git - vim/commitdiff
patch 8.1.2087: cannot easily select one test function to execute v8.1.2087
authorBram Moolenaar <Bram@vim.org>
Fri, 27 Sep 2019 13:34:16 +0000 (15:34 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 27 Sep 2019 13:34:16 +0000 (15:34 +0200)
Problem:    Cannot easily select one test function to execute.
Solution:   Support the $TEST_FILTER environment variable. (Ozaki Kiichi,
            closes #2695)

src/Makefile
src/testdir/runtest.vim
src/testdir/summarize.vim
src/version.c

index 75085ee4b3983b286a45dbd4410014f9f4d60d21..6e676f170de38976a63f8449952859a139a0d087 100644 (file)
@@ -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)
 
index 0d53a754ab330ab0a19c3caa2663e3dc639f71b0..dd717450e4d6a8b2af30aff02f6ee8bba0380c2f 100644 (file)
@@ -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!
index 5bbf0b338a25a7d6f5a7bd4ac639b7b79fa163ae..9cf3f694cadbcb8823c71575b54c08dfad51c052 100644 (file)
@@ -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.
index f08e5e0b9887176f388fac297594e418a58596b2..0776a8a6d3e1348723ec0d2978f33a9e86dda0d8 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2087,
 /**/
     2086,
 /**/