diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-10-07 15:42:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-10-07 15:42:07 +0200 |
commit | d8f27b30d6ec0bcfcb8f44c6201e36c003d1ce88 (patch) | |
tree | 46aded7ced84e056d69f378133d8c50ee5f5491b /src/testdir | |
parent | 019dfe6855e011c02427bb922aafeae0245372c9 (diff) | |
download | vim-git-d8f27b30d6ec0bcfcb8f44c6201e36c003d1ce88.tar.gz |
patch 8.1.0456: running test hangs when the input file is being editedv8.1.0456
Problem: Running test hangs when the input file is being edited.
Solution: Use a SwapExists autocommand to ignore editing the test script.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/Makefile | 6 | ||||
-rw-r--r-- | src/testdir/runtest.vim | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 6a9ef0f97..e9e0f4b32 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -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" diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index c3414914f..ff32abcc3 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -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 |