Debian Codegraph @

vim/syntax/subunit.vim

raw
1 " Vim syntax file
2 " Language: Subunit v1 test protocol
3 " Maintainer: Jelmer Vernooij <[email protected]>
4 " Last Change: 2025-07-09
5 " Version: 0.1
6
7 if exists("b:current_syntax")
8 finish
9 endif
10
11 " Test directives
12 syn keyword subunitDirective test success failure error skip xfail uxsuccess
13 syn keyword subunitDirective progress tags time
14
15 " Test labels (after test directives, up to opening bracket if present)
16 syn match subunitTestLabel "\(test:\s*\)\@<=.\{-}\(\s*\[\)\@="
17 syn match subunitTestLabel "\(test:\s*\)\@<=.*$" contains=subunitDetails
18 syn match subunitTestLabel "\(success:\s*\)\@<=.\{-}\(\s*\[\)\@="
19 syn match subunitTestLabel "\(success:\s*\)\@<=.*$" contains=subunitDetails
20 syn match subunitTestLabel "\(failure:\s*\)\@<=.\{-}\(\s*\[\)\@="
21 syn match subunitTestLabel "\(failure:\s*\)\@<=.*$" contains=subunitDetails
22 syn match subunitTestLabel "\(error:\s*\)\@<=.\{-}\(\s*\[\)\@="
23 syn match subunitTestLabel "\(error:\s*\)\@<=.*$" contains=subunitDetails
24 syn match subunitTestLabel "\(skip:\s*\)\@<=.\{-}\(\s*\[\)\@="
25 syn match subunitTestLabel "\(skip:\s*\)\@<=.*$" contains=subunitDetails
26 syn match subunitTestLabel "\(xfail:\s*\)\@<=.\{-}\(\s*\[\)\@="
27 syn match subunitTestLabel "\(xfail:\s*\)\@<=.*$" contains=subunitDetails
28 syn match subunitTestLabel "\(uxsuccess:\s*\)\@<=.\{-}\(\s*\[\)\@="
29 syn match subunitTestLabel "\(uxsuccess:\s*\)\@<=.*$" contains=subunitDetails
30
31 " Progress indicators
32 syn match subunitProgress "progress:\s*[+-]\?\d\+"
33
34 " Tags
35 syn match subunitTag "tags:\s*.*$" contains=subunitTagList
36 syn match subunitTagList "\(tags:\s*\)\@<=.*$" contained
37
38 " Time stamps
39 syn match subunitTime "time:\s*\d\{4}-\d\{2}-\d\{2}\s\+\d\{2}:\d\{2}:\d\{2}Z\?"
40
41 " Bracketed sections for details (multiline)
42 " Extended descriptions can appear after test result directives
43 syn region subunitDetails start="\[" end="^\s*\]" fold contains=NONE
44
45 " MIME boundaries
46 syn match subunitMimeBoundary "^--[a-zA-Z0-9_-]\+--\?$"
47 syn match subunitMimeHeader "^Content-Type:.*$"
48
49 " Comments (if any line doesn't match known patterns)
50 syn match subunitComment "^#.*$"
51
52 " Define highlighting
53 hi def link subunitDirective Keyword
54 hi def link subunitTestLabel String
55 hi def link subunitProgress Number
56 hi def link subunitTag Special
57 hi def link subunitTagList Identifier
58 hi def link subunitTime Constant
59 hi def link subunitDetails Comment
60 hi def link subunitMimeBoundary PreProc
61 hi def link subunitMimeHeader Type
62 hi def link subunitComment Comment
63
64 let b:current_syntax = "subunit"