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"
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
" 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