summaryrefslogtreecommitdiffstats
path: root/src/testdir/runtest.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-06-12 14:58:39 +0200
committerBram Moolenaar <Bram@vim.org>2018-06-12 14:58:39 +0200
commit8903676d3d4c3fcb37d2a55c67370f30806b1626 (patch)
tree0bc417ec793d418d1df11b536c4ada2e8f79c3bb /src/testdir/runtest.vim
parent7580849df9d6c7c515f5ed784019336d8a8ec0f0 (diff)
patch 8.1.0044: if a test function exists Vim this may go unnoticedv8.1.0044
Problem: If a test function exists Vim this may go unnoticed. Solution: Check for a test funtion quitting Vim. Fix tests that did exit Vim.
Diffstat (limited to 'src/testdir/runtest.vim')
-rw-r--r--src/testdir/runtest.vim12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 5b8126d5d1..4f508a4875 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -124,7 +124,10 @@ func RunTheTest(test)
exe 'call ' . a:test
else
try
+ let s:test = a:test
+ au VimLeavePre * call EarlyExit(s:test)
exe 'call ' . a:test
+ au! VimLeavePre
catch /^\cskipped/
call add(s:messages, ' Skipped')
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
@@ -174,6 +177,15 @@ func AfterTheTest()
endif
endfunc
+func EarlyExit(test)
+ " It's OK for the test we use to test the quit detection.
+ if a:test != 'Test_zz_quit_detected()'
+ call add(v:errors, 'Test caused Vim to exit: ' . a:test)
+ endif
+
+ call FinishTesting()
+endfunc
+
" This function can be called by a test if it wants to abort testing.
func FinishTesting()
call AfterTheTest()