1
0
forked from aniani/vim

patch 8.1.1893: script to summarize test results can be improved

Problem:    Script to summarize test results can be improved.
Solution:   Use "silent" for substitute to avoid reporting number of matches.
            Remove duplicate "set nocp". (Daniel Hahler, closes #4845)
This commit is contained in:
Bram Moolenaar
2019-08-20 21:25:46 +02:00
parent 36e4d985f0
commit f1e0544d41
2 changed files with 10 additions and 8 deletions

View File

@@ -1,7 +1,6 @@
set nocp
if 1 if 1
" This is executed with the eval feature " This is executed only with the eval feature
set nocp set nocompatible
func Count(match, type) func Count(match, type)
if a:type ==# 'executed' if a:type ==# 'executed'
let g:executed += (a:match+0) let g:executed += (a:match+0)
@@ -22,10 +21,11 @@ if 1
try try
" This uses the :s command to just fetch and process the output of the " This uses the :s command to just fetch and process the output of the
" tests, it doesn't acutally replay anything " tests, it doesn't acutally replace anything.
%s/^Executed\s\+\zs\d\+\ze\s\+tests/\=Count(submatch(0),'executed')/egn " And it uses "silent" to avoid reporting the number of matches.
%s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn silent %s/^Executed\s\+\zs\d\+\ze\s\+tests/\=Count(submatch(0),'executed')/egn
%s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn silent %s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn
silent %s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn
call extend(output, ["Skipped:"]) call extend(output, ["Skipped:"])
call extend(output, skipped_output) call extend(output, skipped_output)
@@ -37,7 +37,7 @@ if 1
\ printf(" Skipped: %5d Tests", g:skipped), \ printf(" Skipped: %5d Tests", g:skipped),
\ printf(" %s: %5d Tests", g:failed == 0 ? 'Failed' : 'FAILED', g:failed), \ printf(" %s: %5d Tests", g:failed == 0 ? 'Failed' : 'FAILED', g:failed),
\ "", \ "",
\ ]) \ ])
if filereadable('test.log') if filereadable('test.log')
" outputs and indents the failed test result " outputs and indents the failed test result
call extend(output, ["", "Failures: "]) call extend(output, ["", "Failures: "])

View File

@@ -765,6 +765,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 */
/**/
1893,
/**/ /**/
1892, 1892,
/**/ /**/