From 72f453d149d288061616cb558190d0f7efca0db1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 20 Aug 2019 05:04:15 +0200 Subject: vim-patch:8.1.1476: no statistics displayed after running tests Problem: No statistics displayed after running tests. Solution: Summarize the test results. (Christian Brabandt, closes vim/vim#4391) Also make it possible to report a skipped file. https://github.com/vim/vim/commit/9c0cec65f891492314caadeef87a50251a21e630 Removes our custom no-inits from `$(RUN_VIMTEST)`, since we have `$(NO_INITS)` now also. --- src/nvim/testdir/summarize.vim | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/nvim/testdir/summarize.vim (limited to 'src/nvim/testdir/summarize.vim') diff --git a/src/nvim/testdir/summarize.vim b/src/nvim/testdir/summarize.vim new file mode 100644 index 0000000000..43dbce0f44 --- /dev/null +++ b/src/nvim/testdir/summarize.vim @@ -0,0 +1,60 @@ +if 1 + " This is executed with the eval feature + set nocp + func Count(match, type) + if a:type ==# 'executed' + let g:executed += (a:match+0) + elseif a:type ==# 'failed' + let g:failed = a:match+0 + elseif a:type ==# 'skipped' + let g:skipped += 1 + call extend(g:skipped_output, ["\t".a:match]) + endif + endfunc + + let g:executed = 0 + let g:skipped = 0 + let g:failed = 0 + let g:skipped_output = [] + let g:failed_output = [] + let output = [""] + + try + " This uses the :s command to just fetch and process the output of the + " tests, it doesn't acutally replay anything + %s/^Executed\s\+\zs\d\+\ze\s\+tests/\=Count(submatch(0),'executed')/egn + %s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn + %s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn + + call extend(output, ["Skipped:"]) + call extend(output, skipped_output) + + call extend(output, [ + \ "", + \ "-------------------------------", + \ printf("Executed: %5d Tests", g:executed), + \ printf(" Skipped: %5d Tests", g:skipped), + \ printf(" %s: %5d Tests", g:failed == 0 ? 'Failed' : 'FAILED', g:failed), + \ "", + \ ]) + if filereadable('test.log') + " outputs and indents the failed test result + call extend(output, ["", "Failures: "]) + let failed_output = filter(readfile('test.log'), { v,k -> !empty(k)}) + call extend(output, map(failed_output, { v,k -> "\t".k})) + " Add a final newline + call extend(output, [""]) + endif + + catch " Catch-all + finally + call writefile(output, 'test_result.log') " overwrites an existing file + q! + endtry +endif + +" This is executed without the eval feature +%d +r test.log +w test_result.log +q! -- cgit