vim-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.
8903676d3d

Restore test_assert.vim to run Test_zz_quit_detected().
This commit is contained in:
Jan Edmund Lazo
2019-06-15 20:52:27 -04:00
parent 1abfeff978
commit c6c5754a86
2 changed files with 19 additions and 0 deletions

View File

@@ -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\+', '', ''))
@@ -178,6 +181,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()

View File

@@ -0,0 +1,7 @@
" Test that the methods used for testing work.
" Must be last.
func Test_zz_quit_detected()
" Verify that if a test function ends Vim the test script detects this.
quit
endfunc