1" Vim syntax file 2" Language: Verbose TAP Output 3" Maintainer: Rufus Cable <[email protected]> 4" Remark: Simple syntax highlighting for TAP output 5" License: 6" Copyright: (c) 2008-2013 Rufus Cable 7" Last Change: 2014-12-13 8 9if exists("b:current_syntax") 10 finish 11endif 12 13syn match tapTestDiag /^ *#.*/ contains=tapTestTodo 14syn match tapTestTime /^ *\[\d\d:\d\d:\d\d\].*/ contains=tapTestFile 15syn match tapTestFile /\w\+\/[^. ]*/ contained 16syn match tapTestFileWithDot /\w\+\/[^ ]*/ contained 17 18syn match tapTestPlan /^ *\d\+\.\.\d\+$/ 19 20" tapTest is a line like 'ok 1', 'not ok 2', 'ok 3 - xxxx' 21syn 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 25syn match tapTestLine /\d\+\( .*\|$\)/ contains=tapTestNumber,tapTestLoadMessage,tapTestTodo,tapTestSkip contained 26 27" turn ok/not ok messages green/red respectively 28syn match tapTestStatusOK /ok/ contained 29syn match tapTestStatusNotOK /not ok/ contained 30 31" highlight todo tests 32syn match tapTestTodo /\(# TODO\|Failed (TODO)\) .*$/ contained contains=tapTestTodoRev 33syn match tapTestTodoRev /\<TODO\>/ contained 34 35" highlight skipped tests 36syn match tapTestSkip /# skip .*$/ contained contains=tapTestSkipTag 37syn match tapTestSkipTag /\(# \)\@<=skip\>/ contained 38 39" look behind so "ok 123" and "not ok 124" match test number 40syn match tapTestNumber /\(ok \)\@<=\d\d*/ contained 41syn match tapTestLoadMessage /\*\*\*.*\*\*\*/ contained contains=tapTestThreeStars,tapTestFileWithDot 42syn match tapTestThreeStars /\*\*\*/ contained 43 44syn 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 45syn region tapTestResultsOKRegion start=/^\(All tests successful\|Result: PASS\)/ end=/$/ 46syn region tapTestResultsNotOKRegion start=/^\(# Looks like you planned \|Bailout called\|# Looks like you failed \|Result: FAIL\)/ end=/$/ 47syn region tapTestResultsSummaryRegion start=/^Test Summary Report/ end=/^Files=.*$/ contains=tapTestResultsSummaryHeading,tapTestResultsSummaryNotOK 48 49syn region tapTestResultsSummaryHeading start=/^Test Summary Report/ end=/^-\+$/ contained 50syn region tapTestResultsSummaryNotOK start=/TODO passed:/ end=/$/ contained 51 52syn region tapTestInstructionsRegion start=/\%1l/ end=/^$/ 53 54set foldtext=TAPTestLine_foldtext() 55function! TAPTestLine_foldtext() 56 let line = getline(v:foldstart) 57 let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g') 58 return sub 59endfunction 60 61set foldminlines=5 62set foldcolumn=2 63set foldenable 64set foldmethod=syntax 65syn sync fromstart 66 67if !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 95endif 96 97let b:current_syntax="tapVerboseOutput" 98