comparison src/testdir/runtest.vim @ 14053:d6866c54a311 v8.1.0044

patch 8.1.0044: if a test function exists Vim this may go unnoticed commit https://github.com/vim/vim/commit/8903676d3d4c3fcb37d2a55c67370f30806b1626 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 12 14:58:39 2018 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Tue, 12 Jun 2018 15:00:08 +0200
parents 2678e38e1de6
children 720b857c45ca
comparison
equal deleted inserted replaced
14052:82ca293b28ba 14053:d6866c54a311
122 " Function handles errors itself. This avoids skipping commands after the 122 " Function handles errors itself. This avoids skipping commands after the
123 " error. 123 " error.
124 exe 'call ' . a:test 124 exe 'call ' . a:test
125 else 125 else
126 try 126 try
127 let s:test = a:test
128 au VimLeavePre * call EarlyExit(s:test)
127 exe 'call ' . a:test 129 exe 'call ' . a:test
130 au! VimLeavePre
128 catch /^\cskipped/ 131 catch /^\cskipped/
129 call add(s:messages, ' Skipped') 132 call add(s:messages, ' Skipped')
130 call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', '')) 133 call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
131 catch 134 catch
132 call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) 135 call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
170 let s:fail += 1 173 let s:fail += 1
171 call add(s:errors, 'Found errors in ' . s:test . ':') 174 call add(s:errors, 'Found errors in ' . s:test . ':')
172 call extend(s:errors, v:errors) 175 call extend(s:errors, v:errors)
173 let v:errors = [] 176 let v:errors = []
174 endif 177 endif
178 endfunc
179
180 func EarlyExit(test)
181 " It's OK for the test we use to test the quit detection.
182 if a:test != 'Test_zz_quit_detected()'
183 call add(v:errors, 'Test caused Vim to exit: ' . a:test)
184 endif
185
186 call FinishTesting()
175 endfunc 187 endfunc
176 188
177 " This function can be called by a test if it wants to abort testing. 189 " This function can be called by a test if it wants to abort testing.
178 func FinishTesting() 190 func FinishTesting()
179 call AfterTheTest() 191 call AfterTheTest()