specky/syntax/specrun1.vim
author Mahlon E. Smith <mahlon@martini.nu>
Fri, 24 Dec 2010 20:01:10 -0800
branchvim-stuff
changeset 21 cd1f3381c1ed
parent 19 763cef799c74
permissions -rw-r--r--
Emit file and line for failure source (use gF to jump straight to it!). Show context lines for exception source. Put spec summary run at the top of the screen. Small documentation fixes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     1
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     2
" specky: syntax highlighting for the 'spec' script output (rspec 1.x)
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     3
" $Id$
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     4
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     5
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     6
if has("folding")
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     7
  setlocal foldmethod=syntax
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     8
endif
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
     9
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    10
" Command line as it was called, inserted by Specky
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    11
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    12
syntax match specSpeckyCmd /^Output of: .*/
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    13
highlight link specSpeckyCmd Question
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    14
"syntax match WarningMsg /\.\./
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    15
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    16
" Plain output block (...P..F...)
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    17
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    18
syntax region specPlain start="^[\.PF]\+" end="^$" contains=specFailedPlain,specPendingPlain
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    19
highlight link specPlain MoreMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    20
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    21
" Passed specs (specdoc output)
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    22
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    23
syntax match specPassed /^- .*/ contains=specFailed,specPending
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    24
highlight link specPassed MoreMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    25
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    26
" Pending specs (specdoc output)
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    27
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    28
syntax match specPending /.*PENDING: .*)$/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    29
highlight link specPending Function
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    30
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    31
" (Plain output)
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    32
syntax match specPendingPlain /P/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    33
highlight link specPendingPlain Function
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    34
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    35
" Failed specs (specdoc output)
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    36
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    37
syntax match specFailed /.*\(FAILED\|ERROR\) - \d\+)/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    38
highlight link specFailed WarningMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    39
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    40
" (Plain output)
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    41
syntax match specFailedPlain /F/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    42
highlight link specFailedPlain WarningMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    43
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    44
" Warning details
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    45
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    46
syntax region specFailedDetails start="^\d\+)" end="^$" fold
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    47
highlight link specFailedDetails WarningMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    48
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    49
" Pending specs
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    50
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    51
syntax region specPendingDetails start="^Pending:" end="^$" fold
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    52
highlight link specPendingDetails Function
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    53
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    54
" Timing information
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    55
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    56
syntax match specTimedRun /^Finished in.*/
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    57
highlight link specTimedRun Question
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    58
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    59
" Status summary
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    60
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    61
syntax match specExamplesTotal /^\d\+ examples, .\+/ contains=specTotalFailed,specNoFailures,specTotalPending
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    62
highlight link specExamplesTotal Special
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    63
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    64
syntax match specTotalFailed /\d\+ failure\%[s]/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    65
highlight link specTotalFailed WarningMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    66
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    67
syntax match specTotalPending /\d pending/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    68
highlight link specTotalPending Function
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    69
"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    70
syntax match specNoFailures /0 failures/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    71
highlight link specNoFailures MoreMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    72
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    73
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    74
let b:current_syntax = "specrun"
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    75