]> granicus.if.org Git - vim/commitdiff
patch 8.1.0456: running test hangs when the input file is being edited v8.1.0456
authorBram Moolenaar <Bram@vim.org>
Sun, 7 Oct 2018 13:42:07 +0000 (15:42 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 7 Oct 2018 13:42:07 +0000 (15:42 +0200)
Problem:    Running test hangs when the input file is being edited.
Solution:   Use a SwapExists autocommand to ignore editing the test script.

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

index 6a9ef0f97406017822351819f22f8e53435136ca..e9e0f4b320c8c0432b7b705df8c3769ab55ee6df 100644 (file)
@@ -9,8 +9,10 @@ XXDPROG = ../xxd/xxd
 
 SCRIPTSOURCE = ../../runtime
 
-# Change this to empty to see the verbose output of tests.
-REDIR_TEST_TO_NULL = > /dev/null
+# Comment out this line to see the verbose output of tests.
+#
+# Catches SwapExists to avoid hanging at the ATTENTION prompt.
+REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' > /dev/null
 
 # Uncomment this line to use valgrind for memory leaks and extra warnings.
 #   The output goes into a file "valgrind.testN"
index c3414914f835ca3f615f87157251c83410047ab8..ff32abcc32ac2c62ac3b08626df041803d8eb3dd 100644 (file)
@@ -57,6 +57,19 @@ else
   set encoding=latin1
 endif
 
+" REDIR_TEST_TO_NULL has a very permissive SwapExists autocommand which is for
+" the test_name.vim file itself. Replace it here with a more restrictive one,
+" so we still catch mistakes.
+let s:test_script_fname = expand('%')
+au! SwapExists * call HandleSwapExists()
+func HandleSwapExists()
+  " Only ignore finding a swap file for the test script (the user might be
+  " editing it and do ":make test_name") and the output file.
+  if expand('<afile>') == 'messages' || expand('<afile>') =~ s:test_script_fname
+    let v:swapchoice = 'e'
+  endif
+endfunc
+
 " Avoid stopping at the "hit enter" prompt
 set nomore
 
@@ -146,6 +159,7 @@ func RunTheTest(test)
 
   " Clear any autocommands
   au!
+  au SwapExists * call HandleSwapExists()
 
   " Close any extra tab pages and windows and make the current one not modified.
   while tabpagenr('$') > 1
index d4c872a8320ad340d04b87b2c5acade3257119d9..926efea0bf34c0f3a264e97ac662bf084f4bb572 100644 (file)
@@ -792,6 +792,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    456,
 /**/
     455,
 /**/