specky/syntax/specrun.vim
author Mahlon E. Smith <mahlon@martini.nu>
Fri, 10 Feb 2012 16:08:43 -0800
branchvim-stuff
changeset 22 ed72213b1788
parent 21 cd1f3381c1ed
permissions -rw-r--r--
Updates for rspec 2.8.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
     1
"
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
     2
" specky: syntax highlighting for rspec test output, using the
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
     3
" custom specky formatter. (rspec 2.x)
2
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
     4
" $Id$
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
     5
"
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
     6
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
     7
if has("folding")
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
     8
  setlocal foldmethod=syntax
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
     9
endif
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    10
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    11
" Command line as it was called, inserted by Specky
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    12
syntax match specSpeckyCmd /^Output of: .*/
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    13
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    14
" Pending specs that somehow pass
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    15
syntax keyword specCallout FIXED
2
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    16
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    17
" Passed specs
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    18
syntax match specPassed /.*(\d\+.\d\+s)/ contains=specDuration,specBoxLine
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    19
syntax keyword specPassedKeyword Succeeded
2
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    20
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    21
" Pending specs
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    22
syntax match specPending /.*PENDING: .*)$/ contains=specDuration,specBoxLine
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    23
syntax keyword specPendingKeyword Pending
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    24
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    25
" Failed specs
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    26
syntax match specFailed /.*FAILED - #\d\+)/ contains=specDuration,specBoxLine
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    27
syntax keyword specFailedKeyword Failed
2
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    28
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    29
" Failure details
21
cd1f3381c1ed Emit file and line for failure source (use gF to jump straight to it!).
Mahlon E. Smith <mahlon@martini.nu>
parents: 19
diff changeset
    30
syntax region specFailedDetails start="^FAILURE - #\d\+)" end="^$" fold contains=specCallout,specErrorLine
cd1f3381c1ed Emit file and line for failure source (use gF to jump straight to it!).
Mahlon E. Smith <mahlon@martini.nu>
parents: 19
diff changeset
    31
syntax match specErrorLine /^  >>/
cd1f3381c1ed Emit file and line for failure source (use gF to jump straight to it!).
Mahlon E. Smith <mahlon@martini.nu>
parents: 19
diff changeset
    32
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    33
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    34
" Boxes
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    35
syntax match specBox /^\(\s\+\)\?\(+[+-]\+\||.*|\)$/ contains=specFailedKeyword,specDurationKeyword,specPendingKeyword,specPassedKeyword,specBoxContent
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    36
syntax match specBoxContent /[a-zA-Z0-9]\+/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    37
syntax match specBoxLine /^\(\s\+\)\?|/ contained
2
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    38
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    39
" Spec timing
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    40
" syntax match specDuration /\d\+\.\d\+s/ contained
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    41
" syntax keyword specDurationKeyword Duration
2
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    42
19
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    43
highlight def link specSpeckyCmd Question
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    44
highlight def link specCallout Todo
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    45
highlight def link specPassed MoreMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    46
highlight def link specPassedKeyword specPassed
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    47
highlight def link specPending Function
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    48
highlight def link specPendingKeyword specPending
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    49
highlight def link specFailed WarningMsg
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    50
highlight def link specFailedKeyword specFailed
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    51
highlight def link specFailedDetails specFailed
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    52
highlight def link specDuration Normal
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    53
highlight def link specBox LineNr
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    54
highlight def link specBoxContent Constant
763cef799c74 Specky: support rspec 2.x by default.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    55
highlight def link specBoxLine LineNr
21
cd1f3381c1ed Emit file and line for failure source (use gF to jump straight to it!).
Mahlon E. Smith <mahlon@martini.nu>
parents: 19
diff changeset
    56
highlight def link specErrorLine ErrorMsg
2
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    57
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    58
let b:current_syntax = "specrun"
6b33188f1694 Moving Specky into a Vim subfolder.
mahlon
parents:
diff changeset
    59