specky/syntax/specrun.vim
branchvim-stuff
changeset 19 763cef799c74
parent 6 31d00503e038
child 21 cd1f3381c1ed
equal deleted inserted replaced
18:bf8f3c788cad 19:763cef799c74
     1 "
     1 "
     2 " specky: syntax highlighting for the 'spec' script output
     2 " specky: syntax highlighting for rspec test output, using the
       
     3 " custom specky formatter. (rspec 2.x)
     3 " $Id$
     4 " $Id$
     4 "
     5 "
     5 
     6 
     6 if has("folding")
     7 if has("folding")
     7   setlocal foldmethod=syntax
     8   setlocal foldmethod=syntax
     8 endif
     9 endif
     9 
    10 
    10 " Command line as it was called, inserted by Specky
    11 " Command line as it was called, inserted by Specky
    11 "
       
    12 syntax match specSpeckyCmd /^Output of: .*/
    12 syntax match specSpeckyCmd /^Output of: .*/
    13 highlight link specSpeckyCmd Question
       
    14 "syntax match WarningMsg /\.\./
       
    15 
    13 
    16 " Plain output block (...P..F...)
    14 " Pending specs that somehow pass
    17 "
    15 syntax keyword specCallout FIXED
    18 syntax region specPlain start="^[\.PF]\+" end="^$" contains=specFailedPlain,specPendingPlain
       
    19 highlight link specPlain MoreMsg
       
    20 
    16 
    21 " Passed specs (specdoc output)
    17 " Passed specs
    22 "
    18 syntax match specPassed /.*(\d\+.\d\+s)/ contains=specDuration,specBoxLine
    23 syntax match specPassed /^- .*/ contains=specFailed,specPending
    19 syntax keyword specPassedKeyword Succeeded
    24 highlight link specPassed MoreMsg
       
    25 
       
    26 " Pending specs (specdoc output)
       
    27 "
       
    28 syntax match specPending /.*PENDING: .*)$/ contained
       
    29 highlight link specPending Function
       
    30 "
       
    31 " (Plain output)
       
    32 syntax match specPendingPlain /P/ contained
       
    33 highlight link specPendingPlain Function
       
    34 
       
    35 " Failed specs (specdoc output)
       
    36 "
       
    37 syntax match specFailed /.*\(FAILED\|ERROR\) - \d\+)/ contained
       
    38 highlight link specFailed WarningMsg
       
    39 "
       
    40 " (Plain output)
       
    41 syntax match specFailedPlain /F/ contained
       
    42 highlight link specFailedPlain WarningMsg
       
    43 
       
    44 " Warning details
       
    45 "
       
    46 syntax region specFailedDetails start="^\d\+)" end="^$" fold
       
    47 highlight link specFailedDetails WarningMsg
       
    48 
    20 
    49 " Pending specs
    21 " Pending specs
    50 "
    22 syntax match specPending /.*PENDING: .*)$/ contains=specDuration,specBoxLine
    51 syntax region specPendingDetails start="^Pending:" end="^$" fold
    23 syntax keyword specPendingKeyword Pending
    52 highlight link specPendingDetails Function
       
    53 
    24 
    54 " Timing information
    25 " Failed specs
    55 "
    26 syntax match specFailed /.*FAILED - #\d\+)/ contains=specDuration,specBoxLine
    56 syntax match specTimedRun /^Finished in.*/
    27 syntax keyword specFailedKeyword Failed
    57 highlight link specTimedRun Question
       
    58 
    28 
    59 " Status summary
    29 " Failure details
    60 "
    30 syntax region specFailedDetails start="^FAILURE - #\d\+)" end="^$" fold contains=specCallout
    61 syntax match specExamplesTotal /^\d\+ examples, .\+/ contains=specTotalFailed,specNoFailures,specTotalPending
       
    62 highlight link specExamplesTotal Special
       
    63 "
       
    64 syntax match specTotalFailed /\d\+ failure\%[s]/ contained
       
    65 highlight link specTotalFailed WarningMsg
       
    66 "
       
    67 syntax match specTotalPending /\d pending/ contained
       
    68 highlight link specTotalPending Function
       
    69 "
       
    70 syntax match specNoFailures /0 failures/ contained
       
    71 highlight link specNoFailures MoreMsg
       
    72 
    31 
       
    32 " Boxes
       
    33 syntax match specBox /^\(\s\+\)\?\(+[+-]\+\||.*|\)$/ contains=specFailedKeyword,specDurationKeyword,specPendingKeyword,specPassedKeyword,specBoxContent
       
    34 syntax match specBoxContent /[a-zA-Z0-9]\+/ contained
       
    35 syntax match specBoxLine /^\(\s\+\)\?|/ contained
       
    36 
       
    37 " Spec timing
       
    38 " syntax match specDuration /\d\+\.\d\+s/ contained
       
    39 " syntax keyword specDurationKeyword Duration
       
    40 
       
    41 highlight def link specSpeckyCmd Question
       
    42 highlight def link specCallout Todo
       
    43 highlight def link specPassed MoreMsg
       
    44 highlight def link specPassedKeyword specPassed
       
    45 highlight def link specPending Function
       
    46 highlight def link specPendingKeyword specPending
       
    47 highlight def link specFailed WarningMsg
       
    48 highlight def link specFailedKeyword specFailed
       
    49 highlight def link specFailedDetails specFailed
       
    50 highlight def link specDuration Normal
       
    51 highlight def link specBox LineNr
       
    52 highlight def link specBoxContent Constant
       
    53 highlight def link specBoxLine LineNr
    73 
    54 
    74 let b:current_syntax = "specrun"
    55 let b:current_syntax = "specrun"
    75 
    56