Skip to content

Commit 8a7d482

Browse files
committed
Add success/failure glyph beside completed tests
1 parent 95c0005 commit 8a7d482

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

autoload/OmniSharp/testrunner.vim

+13-3
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,16 @@ function! s:buffer.painttest(test, lnum) abort
298298
endif
299299
let lines = []
300300
let state = s:utils.state2char[a:test.state]
301-
call add(lines, printf('%s %s', state, a:test.name))
301+
let glyph = ''
302+
if state ==# '*' && get(g:, 'OmniSharp_testrunner_glyph', 1)
303+
let glyph = get(g:, 'OmniSharp_testrunner_glyph_passed', '')
304+
elseif state ==# '!' && get(g:, 'OmniSharp_testrunner_glyph', 1)
305+
let glyph = get(g:, 'OmniSharp_testrunner_glyph_failed', '')
306+
endif
307+
if glyph !=# ''
308+
let glyph = printf('|| %s || ', glyph)
309+
endif
310+
call add(lines, printf('%s %s%s', state, glyph, a:test.name))
302311
if state ==# '-' && !has_key(a:test, 'spintimer')
303312
call s:spinner.start(a:test, a:lnum)
304313
endif
@@ -434,7 +443,7 @@ function! s:UpdateState(bufnr, state, ...) abort
434443
let lines = getbufline(s:runner.bufnr, 1, '$')
435444
let pattern = '^ ' . substitute(filename, '/', '\\/', 'g')
436445
let fileline = match(lines, pattern) + 1
437-
let pattern = '^[-|*!] ' . testname
446+
let pattern = '^[-|*!] \%(|| .\{-} || \)\?' . testname
438447
let testline = match(lines, pattern, fileline) + 1
439448

440449
let patterns = ['^[-|*!] \S', '^__$', '^$']
@@ -593,7 +602,8 @@ function! s:utils.findTest() abort
593602
let testline = search(testpattern, 'bcnWz')
594603
endif
595604
if testline > 0
596-
let testname = matchlist(getline(testline), '[-|*!] \zs.*$')[0]
605+
let line = getline(testline)
606+
let testname = matchlist(line, '[-|*!] \%(|| .\{-} || \)\?\zs.*$')[0]
597607
let projectline = search('^;', 'bcnWz')
598608
let projectkey = matchlist(getline(projectline), '^\S\+')[0]
599609
let fileline = search('^ \f', 'bcnWz')

syntax/omnisharptest.vim

+9-2
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,19 @@ syn match ostFileDivider "^__$" conceal
3232

3333
syn match ostStateNotRun "^|.*" contains=ostStatePrefix,ostTestNamespace
3434
syn match ostStateRunning "^-.*" contains=ostStatePrefix,ostTestNamespace,ostRunningSuffix
35-
syn match ostStatePassed "^\*.*" contains=ostStatePrefix,ostTestNamespace
36-
syn match ostStateFailed "^!.*" contains=ostStatePrefix,ostTestNamespace
35+
syn match ostStatePassed "^\*.*" contains=ostStatePrefix,ostTestNamespace,ostStatePassedGlyph,ostCompletePrefixDivider
36+
syn match ostStateFailed "^!.*" contains=ostStatePrefix,ostTestNamespace,ostStateFailedGlyph,ostCompletePrefixDivider
3737
syn match ostStatePrefix "^[|\*!-]" conceal contained
3838
syn match ostTestNamespace "\%(\w\+\.\)*\ze\w\+" conceal contained
3939

4040
syn match ostRunningSuffix " -- .*" contained contains=ostRunningSpinner,ostRunningSuffixDivider
4141
syn match ostRunningSuffixDivider " \zs--" conceal contained
4242
syn match ostRunningSpinner " -- \zs.*" contained
4343

44+
syn match ostStatePassedGlyph "\%(|| \)\@<=.\{-}\ze || " contained
45+
syn match ostStateFailedGlyph "\%(|| \)\@<=.\{-}\ze || " contained
46+
syn match ostCompletePrefixDivider "|| " conceal contained
47+
4448
syn region ostFailure start="^>" end="^[^>]"me=s-1 contains=ostFailurePrefix,ostStackLoc,ostStackNoLoc fold
4549
syn match ostFailurePrefix "^>" conceal contained
4650
syn region ostStackLoc start=" __ "hs=e+1 end=" __ "he=e-1 contains=ostStackFile,ostStackDelimiter,ostStackNamespace contained keepend
@@ -66,7 +70,9 @@ hi def link ostStateNotRun Comment
6670
hi def link ostStateRunning Identifier
6771
hi def link ostRunningSpinner Normal
6872
hi def link ostStatePassed Title
73+
hi def link ostStatePassedGlyph Title
6974
hi def link ostStateFailed WarningMsg
75+
hi def link ostStateFailedGlyph WarningMsg
7076
hi def link ostStackLoc Identifier
7177
hi def link ostOutput Comment
7278

@@ -78,6 +84,7 @@ hi def link ostFileDivider NonText
7884
hi def link ostStatePrefix NonText
7985
hi def link ostFailurePrefix NonText
8086
hi def link ostRunningSuffixDivider NonText
87+
hi def link ostCompletePrefixDivider NonText
8188
hi def link ostStackDelimiter NonText
8289
hi def link ostStackFileDelimiter NonText
8390
hi def link ostStackNoLocDelimiter NonText

0 commit comments

Comments
 (0)