annotate src/testdir/summarize.vim @ 17901:14122cb0ea3d v8.1.1947

patch 8.1.1947: when executing one test the report doesn't show it Commit: https://github.com/vim/vim/commit/60b1bcfe92da1d7b8f894c91192f3a76e8aec391 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 30 19:05:32 2019 +0200 patch 8.1.1947: when executing one test the report doesn't show it Problem: When executing one test the report doesn't show it. Solution: Adjust the regexp. (Daniel Hahler, closes https://github.com/vim/vim/issues/4879)
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Aug 2019 19:15:03 +0200
parents 7f95fa061abc
children ef35a3a70c24
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 if 1
17793
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
2 " This is executed only with the eval feature
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
3 set nocompatible
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 func Count(match, type)
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 if a:type ==# 'executed'
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 let g:executed += (a:match+0)
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 elseif a:type ==# 'failed'
16976
7160dcd5c1d2 patch 8.1.1488: summary of tests has incorrect failed count
Bram Moolenaar <Bram@vim.org>
parents: 16955
diff changeset
8 let g:failed += a:match+0
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 elseif a:type ==# 'skipped'
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 let g:skipped += 1
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 call extend(g:skipped_output, ["\t".a:match])
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 endif
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 endfunc
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 let g:executed = 0
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 let g:skipped = 0
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 let g:failed = 0
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 let g:skipped_output = []
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 let g:failed_output = []
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let output = [""]
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 try
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 " This uses the :s command to just fetch and process the output of the
17901
14122cb0ea3d patch 8.1.1947: when executing one test the report doesn't show it
Bram Moolenaar <Bram@vim.org>
parents: 17793
diff changeset
24 " tests, it doesn't actually replace anything.
17793
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
25 " And it uses "silent" to avoid reporting the number of matches.
17901
14122cb0ea3d patch 8.1.1947: when executing one test the report doesn't show it
Bram Moolenaar <Bram@vim.org>
parents: 17793
diff changeset
26 silent %s/^Executed\s\+\zs\d\+\ze\s\+tests\?/\=Count(submatch(0),'executed')/egn
17793
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
27 silent %s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
28 silent %s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 call extend(output, ["Skipped:"])
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call extend(output, skipped_output)
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 call extend(output, [
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 \ "",
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 \ "-------------------------------",
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 \ printf("Executed: %5d Tests", g:executed),
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 \ printf(" Skipped: %5d Tests", g:skipped),
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 \ printf(" %s: %5d Tests", g:failed == 0 ? 'Failed' : 'FAILED', g:failed),
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 \ "",
17793
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
40 \ ])
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 if filereadable('test.log')
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 " outputs and indents the failed test result
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 call extend(output, ["", "Failures: "])
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 let failed_output = filter(readfile('test.log'), { v,k -> !empty(k)})
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 call extend(output, map(failed_output, { v,k -> "\t".k}))
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 " Add a final newline
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call extend(output, [""])
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 endif
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 catch " Catch-all
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 finally
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 call writefile(output, 'test_result.log') " overwrites an existing file
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 endtry
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 endif
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 q!