tap.vim (4140B)
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: Vim License (see :help license) 6 " Copyright: (c) 2008-2013 Rufus Cable 7 " Last Change: 2020 Mar 15 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 /\c\(# TODO\|Failed (TODO)\) .*$/ contained contains=tapTestTodoRev 33 syn match tapTestTodoRev /\c\<TODO\>/ contained 34 35 " highlight skipped tests 36 syn match tapTestSkip /\c# skip .*$/ contained contains=tapTestSkipTag 37 syn match tapTestSkipTag /\c\(# \)\@<=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 syn sync fromstart 55 56 if !exists("did_tapverboseoutput_syntax_inits") 57 let did_tapverboseoutput_syntax_inits = 1 58 59 hi tapTestStatusOK term=bold ctermfg=green guifg=Green 60 hi tapTestStatusNotOK term=reverse ctermfg=black ctermbg=red guifg=Black guibg=Red 61 hi tapTestTodo term=bold ctermfg=yellow ctermbg=black guifg=Yellow guibg=Black 62 hi tapTestTodoRev term=reverse ctermfg=black ctermbg=yellow guifg=Black guibg=Yellow 63 hi tapTestSkip term=bold ctermfg=lightblue guifg=LightBlue 64 hi tapTestSkipTag term=reverse ctermfg=black ctermbg=lightblue guifg=Black guibg=LightBlue 65 hi tapTestTime term=bold ctermfg=blue guifg=Blue 66 hi tapTestFile term=reverse ctermfg=black ctermbg=yellow guibg=Black guifg=Yellow 67 hi tapTestLoadedFile term=bold ctermfg=black ctermbg=cyan guibg=Cyan guifg=Black 68 hi tapTestThreeStars term=reverse ctermfg=blue guifg=Blue 69 hi tapTestPlan term=bold ctermfg=yellow guifg=Yellow 70 71 hi link tapTestFileWithDot tapTestLoadedFile 72 hi link tapTestNumber Number 73 hi link tapTestDiag Comment 74 75 hi tapTestRegion ctermbg=green 76 77 hi tapTestResultsOKRegion ctermbg=green ctermfg=black 78 hi tapTestResultsNotOKRegion ctermbg=red ctermfg=black 79 80 hi tapTestResultsSummaryHeading ctermbg=blue ctermfg=white 81 hi tapTestResultsSummaryNotOK ctermbg=red ctermfg=black 82 83 hi tapTestInstructionsRegion ctermbg=lightmagenta ctermfg=black 84 endif 85 86 let b:current_syntax="tapVerboseOutput"