Show the results of pending tests in the end

This commit is contained in:
ichizok
2022-01-17 10:46:42 +09:00
parent c3fb058e97
commit bb9dddb390
2 changed files with 31 additions and 10 deletions
+19 -10
View File
@@ -288,6 +288,15 @@ endfunc
func AfterTheTest(func_name)
if len(v:errors) > 0
if has('gui_macvim') && g:test_is_flaky
" MacVim's currently doesn't always pass these tests. Make these
" tests pending for now before a more proper fix is implemented.
call add(s:messages, 'MacVim marked ' .. a:func_name .. 'as pending')
let s:pending += 1
call add(s:errors_pending, 'Found errors in ' . g:testfunc . ':')
call extend(s:errors_pending, v:errors)
call add(s:errors_pending, 'PENDING ' .. a:func_name)
else
if match(s:may_fail_list, '^' .. a:func_name) >= 0
let s:fail_expected += 1
call add(s:errors_expected, 'Found errors in ' . g:testfunc . ':')
@@ -297,6 +306,7 @@ func AfterTheTest(func_name)
call add(s:errors, 'Found errors in ' . g:testfunc . ':')
call extend(s:errors, v:errors)
endif
endif
let v:errors = []
endif
endfunc
@@ -321,7 +331,7 @@ func FinishTesting()
" Clean up files created by setup.vim
call delete('XfakeHOME', 'rf')
if s:fail == 0 && s:fail_expected == 0
if s:fail == 0 && s:fail_expected == 0 && s:pending == 0
" Success, create the .res file so that make knows it's done.
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
write
@@ -371,6 +381,12 @@ func FinishTesting()
call add(s:messages, message)
call extend(s:messages, s:errors_expected)
endif
if s:pending > 0
let message = s:pending . ' FAILED (pending):'
echo message
call add(s:messages, message)
call extend(s:messages, s:errors_pending)
endif
" Add SKIPPED messages
call extend(s:messages, s:skipped)
@@ -395,6 +411,8 @@ let s:errors = []
let s:errors_expected = []
let s:messages = []
let s:skipped = []
let s:pending = 0
let s:errors_pending = []
if expand('%') =~ 'test_vimscript.vim'
" this test has intentional errors, don't use try/catch.
source %
@@ -472,15 +490,6 @@ for g:testfunc in sort(s:tests)
if g:run_nr == 5 || prev_error == v:errors[0]
call add(total_errors, 'Flaky test failed too often, giving up')
let v:errors = total_errors
if has('gui_macvim')
" MacVim's currently doesn't always pass these tests. Make these
" tests pending for now before a more proper fix is implemented.
call extend(s:messages, [
\ 'Flaky test failed too often, giving up',
\ 'MacVim marked ' . g:testfunc . ' as pending',
\ ])
let v:errors = []
endif
break
endif
+12
View File
@@ -11,14 +11,19 @@ if 1
elseif a:type ==# 'skipped'
let g:skipped += 1
call extend(g:skipped_output, ["\t" .. a:match])
elseif a:type ==# 'pending'
let g:pending += 1
call extend(g:pending_output, ["\t" .. a:match])
endif
endfunc
let g:executed = 0
let g:skipped = 0
let g:failed = 0
let g:pending = 0
let g:skipped_output = []
let g:failed_output = []
let g:pending_output = []
let output = [""]
if $TEST_FILTER != ''
@@ -32,9 +37,15 @@ if 1
silent %s/Executed\s\+\zs\d\+\ze\s\+tests\?/\=Count(submatch(0),'executed')/egn
silent %s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn
silent %s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn
silent %s/^PENDING \zs.*/\=Count(submatch(0), 'pending')/egn
call extend(output, ["Skipped:"])
call extend(output, skipped_output)
if !empty(pending_output)
call add(output, "")
call extend(output, ["Pending:"])
call extend(output, pending_output)
endif
call extend(output, [
\ "",
@@ -42,6 +53,7 @@ if 1
\ printf("Executed: %5d Tests", g:executed),
\ printf(" Skipped: %5d Tests", g:skipped),
\ printf(" %s: %5d Tests", g:failed == 0 ? 'Failed' : 'FAILED', g:failed),
\ printf(" %s: %5d Tests", g:pending == 0 ? 'Pending' : 'PENDING', g:pending),
\ "",
\ ])
if filereadable('test.log')