blob: 6b00b1d588c9c2378be6ddcfbb4de3849a77c3d4 [file] [log] [blame]
Bram Moolenaar37c64c72017-09-19 22:06:03 +02001" Vim syntax file
2" Language: Verbose TAP Output
3" Maintainer: Rufus Cable <rufus@threebytesfull.com>
4" Remark: Simple syntax highlighting for TAP output
Bram Moolenaar8c1b8cb2022-06-14 17:41:28 +01005" License: Vim License (see :help license)
Bram Moolenaar37c64c72017-09-19 22:06:03 +02006" Copyright: (c) 2008-2013 Rufus Cable
Bram Moolenaar8c1b8cb2022-06-14 17:41:28 +01007" Last Change: 2020 Mar 15
Bram Moolenaar37c64c72017-09-19 22:06:03 +02008
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
Bram Moolenaar8c1b8cb2022-06-14 17:41:28 +010032syn match tapTestTodo /\c\(# TODO\|Failed (TODO)\) .*$/ contained contains=tapTestTodoRev
33syn match tapTestTodoRev /\c\<TODO\>/ contained
Bram Moolenaar37c64c72017-09-19 22:06:03 +020034
35" highlight skipped tests
Bram Moolenaar8c1b8cb2022-06-14 17:41:28 +010036syn match tapTestSkip /\c# skip .*$/ contained contains=tapTestSkipTag
37syn match tapTestSkipTag /\c\(# \)\@<=skip\>/ contained
Bram Moolenaar37c64c72017-09-19 22:06:03 +020038
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
Bram Moolenaar37c64c72017-09-19 22:06:03 +020054syn sync fromstart
55
56if !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
84endif
85
86let b:current_syntax="tapVerboseOutput"