0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.1.0044: if a test function exists Vim this may go unnoticed

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.
This commit is contained in:
Bram Moolenaar
2018-06-12 14:58:39 +02:00
parent 7580849df9
commit 8903676d3d
3 changed files with 20 additions and 0 deletions

View File

@@ -124,7 +124,10 @@ func RunTheTest(test)
exe 'call ' . a:test exe 'call ' . a:test
else else
try try
let s:test = a:test
au VimLeavePre * call EarlyExit(s:test)
exe 'call ' . a:test exe 'call ' . a:test
au! VimLeavePre
catch /^\cskipped/ catch /^\cskipped/
call add(s:messages, ' Skipped') call add(s:messages, ' Skipped')
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', '')) call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
@@ -174,6 +177,15 @@ func AfterTheTest()
endif endif
endfunc 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. " This function can be called by a test if it wants to abort testing.
func FinishTesting() func FinishTesting()
call AfterTheTest() call AfterTheTest()

View File

@@ -198,3 +198,9 @@ func Test_user_is_happy()
smile smile
sleep 300m sleep 300m
endfunc endfunc
" Must be last.
func Test_zz_quit_detected()
" Verify that if a test function ends Vim the test script detects this.
quit
endfunc

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
44,
/**/ /**/
43, 43,
/**/ /**/