aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-08-14 01:56:59 +0200
committerGitHub <noreply@github.com>2019-08-14 01:56:59 +0200
commitc285ebfa73d9347a64022ac277cc68fb0683a794 (patch)
tree417f3c2050cfbac06caf79cf1afef388310d8d13
parentf2377e3575c5efdfe3b8f901ce22ece97588b734 (diff)
downloadrneovim-c285ebfa73d9347a64022ac277cc68fb0683a794.tar.gz
rneovim-c285ebfa73d9347a64022ac277cc68fb0683a794.tar.bz2
rneovim-c285ebfa73d9347a64022ac277cc68fb0683a794.zip
vim-patch:8.1.0456: running test hangs when the input file is being edited (#10764)
Problem: Running test hangs when the input file is being edited. Solution: Use a SwapExists autocommand to ignore editing the test script. https://github.com/vim/vim/commit/d8f27b30d6ec0bcfcb8f44c6201e36c003d1ce88
-rw-r--r--src/nvim/testdir/runtest.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim
index e0c40181e4..5c62538b7d 100644
--- a/src/nvim/testdir/runtest.vim
+++ b/src/nvim/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
@@ -150,6 +163,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