12499
|
1 " Vim syntax file
|
|
2 " Language: Verbose TAP Output
|
|
3 " Maintainer: Rufus Cable <rufus@threebytesfull.com>
|
|
4 " Remark: Simple syntax highlighting for TAP output
|
|
5 " License:
|
|
6 " Copyright: (c) 2008-2013 Rufus Cable
|
|
7 " Last Change: 2014-12-13
|
|
8
|
|
9 if exists("b:current_syntax")
|
|
10 finish
|
|
11 endif
|
|
12
|
|
13 syn match tapTestDiag /^ *#.*/ contains=tapTestTodo
|
|
14 syn match tapTestTime /^ *\[\d\d:\d\d:\d\d\].*/ contains=tapTestFile
|
|
15 syn match tapTestFile /\w\+\/[^. ]*/ contained
|
|
16 syn match tapTestFileWithDot /\w\+\/[^ ]*/ contained
|
|
17
|
|
18 syn match tapTestPlan /^ *\d\+\.\.\d\+$/
|
|
19
|
|
20 " tapTest is a line like 'ok 1', 'not ok 2', 'ok 3 - xxxx'
|
|
21 syn match tapTest /^ *\(not \)\?ok \d\+.*/ contains=tapTestStatusOK,tapTestStatusNotOK,tapTestLine
|
|
22
|
|
23 " tapTestLine is the line without the ok/not ok status - i.e. number and
|
|
24 " optional message
|
|
25 syn match tapTestLine /\d\+\( .*\|$\)/ contains=tapTestNumber,tapTestLoadMessage,tapTestTodo,tapTestSkip contained
|
|
26
|
|
27 " turn ok/not ok messages green/red respectively
|
|
28 syn match tapTestStatusOK /ok/ contained
|
|
29 syn match tapTestStatusNotOK /not ok/ contained
|
|
30
|
|
31 " highlight todo tests
|
|
32 syn match tapTestTodo /\(# TODO\|Failed (TODO)\) .*$/ contained contains=tapTestTodoRev
|
|
33 syn match tapTestTodoRev /\<TODO\>/ contained
|
|
34
|
|
35 " highlight skipped tests
|
|
36 syn match tapTestSkip /# skip .*$/ contained contains=tapTestSkipTag
|
|
37 syn match tapTestSkipTag /\(# \)\@<=skip\>/ contained
|
|
38
|
|
39 " look behind so "ok 123" and "not ok 124" match test number
|
|
40 syn match tapTestNumber /\(ok \)\@<=\d\d*/ contained
|
|
41 syn match tapTestLoadMessage /\*\*\*.*\*\*\*/ contained contains=tapTestThreeStars,tapTestFileWithDot
|
|
42 syn match tapTestThreeStars /\*\*\*/ contained
|
|
43
|
|
44 syn region tapTestRegion start=/^ *\(not \)\?ok.*$/me=e+1 end=/^\(\(not \)\?ok\|# Looks like you planned \|All tests successful\|Bailout called\)/me=s-1 fold transparent excludenl
|
|
45 syn region tapTestResultsOKRegion start=/^\(All tests successful\|Result: PASS\)/ end=/$/
|
|
46 syn region tapTestResultsNotOKRegion start=/^\(# Looks like you planned \|Bailout called\|# Looks like you failed \|Result: FAIL\)/ end=/$/
|
|
47 syn region tapTestResultsSummaryRegion start=/^Test Summary Report/ end=/^Files=.*$/ contains=tapTestResultsSummaryHeading,tapTestResultsSummaryNotOK
|
|
48
|
|
49 syn region tapTestResultsSummaryHeading start=/^Test Summary Report/ end=/^-\+$/ contained
|
|
50 syn region tapTestResultsSummaryNotOK start=/TODO passed:/ end=/$/ contained
|
|
51
|
|
52 syn region tapTestInstructionsRegion start=/\%1l/ end=/^$/
|
|
53
|
|
54 set foldtext=TAPTestLine_foldtext()
|
|
55 function! TAPTestLine_foldtext()
|
|
56 let line = getline(v:foldstart)
|
|
57 let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
|
|
58 return sub
|
|
59 endfunction
|
|
60
|
|
61 set foldminlines=5
|
|
62 set foldcolumn=2
|
|
63 set foldenable
|
|
64 set foldmethod=syntax
|
|
65 syn sync fromstart
|
|
66
|
|
67 if !exists("did_tapverboseoutput_syntax_inits")
|
|
68 let did_tapverboseoutput_syntax_inits = 1
|
|
69
|
|
70 hi tapTestStatusOK term=bold ctermfg=green guifg=Green
|
|
71 hi tapTestStatusNotOK term=reverse ctermfg=black ctermbg=red guifg=Black guibg=Red
|
|
72 hi tapTestTodo term=bold ctermfg=yellow ctermbg=black guifg=Yellow guibg=Black
|
|
73 hi tapTestTodoRev term=reverse ctermfg=black ctermbg=yellow guifg=Black guibg=Yellow
|
|
74 hi tapTestSkip term=bold ctermfg=lightblue guifg=LightBlue
|
|
75 hi tapTestSkipTag term=reverse ctermfg=black ctermbg=lightblue guifg=Black guibg=LightBlue
|
|
76 hi tapTestTime term=bold ctermfg=blue guifg=Blue
|
|
77 hi tapTestFile term=reverse ctermfg=black ctermbg=yellow guibg=Black guifg=Yellow
|
|
78 hi tapTestLoadedFile term=bold ctermfg=black ctermbg=cyan guibg=Cyan guifg=Black
|
|
79 hi tapTestThreeStars term=reverse ctermfg=blue guifg=Blue
|
|
80 hi tapTestPlan term=bold ctermfg=yellow guifg=Yellow
|
|
81
|
|
82 hi link tapTestFileWithDot tapTestLoadedFile
|
|
83 hi link tapTestNumber Number
|
|
84 hi link tapTestDiag Comment
|
|
85
|
|
86 hi tapTestRegion ctermbg=green
|
|
87
|
|
88 hi tapTestResultsOKRegion ctermbg=green ctermfg=black
|
|
89 hi tapTestResultsNotOKRegion ctermbg=red ctermfg=black
|
|
90
|
|
91 hi tapTestResultsSummaryHeading ctermbg=blue ctermfg=white
|
|
92 hi tapTestResultsSummaryNotOK ctermbg=red ctermfg=black
|
|
93
|
|
94 hi tapTestInstructionsRegion ctermbg=lightmagenta ctermfg=black
|
|
95 endif
|
|
96
|
|
97 let b:current_syntax="tapVerboseOutput"
|