@@ -115,6 +115,7 @@ function! s:run.single.test(bufferTests) abort
115
115
return s: utils .log .warn (' No test found' )
116
116
endif
117
117
let s: run .running = 1
118
+ call OmniSharp#testrunner#StateRunning (bufnr , currentTest.name)
118
119
let project = OmniSharp#GetHost (bufnr ).project
119
120
let targetFramework = project.MsBuildProject.TargetFramework
120
121
let opts = {
@@ -132,17 +133,22 @@ function! s:run.single.test(bufferTests) abort
132
133
endfunction
133
134
134
135
function ! s: run .single.complete (summary) abort
136
+ if a: summary .pass && len (a: summary .locations) == 0
137
+ echomsg ' No tests were run'
138
+ " Do we ever reach here?
139
+ " call OmniSharp#testrunner#StateSkipped(bufnr)
140
+ endif
141
+ let location = a: summary .locations[0 ]
142
+ call s: run .updatestate (location)
135
143
if a: summary .pass
136
- if len (a: summary .locations) == 0
137
- echomsg ' No tests were run'
138
- elseif get (a: summary .locations[0 ], ' type' , ' ' ) == # ' W'
139
- call s: utils .log .warn (a: summary .locations[0 ].name . ' : skipped' )
144
+ if get (location, ' type' , ' ' ) == # ' W'
145
+ call s: utils .log .warn (location.name . ' : skipped' )
140
146
else
141
- call s: utils .log .emphasize (a: summary .locations[ 0 ] .name . ' : passed' )
147
+ call s: utils .log .emphasize (location .name . ' : passed' )
142
148
endif
143
149
else
144
- echomsg a: summary .locations[ 0 ] .name . ' : failed'
145
- let title = ' Test failure: ' . a: summary .locations[ 0 ] .name
150
+ echomsg location .name . ' : failed'
151
+ let title = ' Test failure: ' . location .name
146
152
let what = {}
147
153
if len (a: summary .locations) > 1
148
154
let what.quickfixtextfunc = {info- >
@@ -187,7 +193,9 @@ function! s:run.multiple.prepare(bufferTests) abort
187
193
for btests in a: bufferTests
188
194
let bufnr = btests.bufnr
189
195
let tests = btests.tests
196
+ let testnames = map (copy (tests), {_,t - > t .name})
190
197
if len (tests)
198
+ call OmniSharp#testrunner#StateRunning (bufnr , testnames)
191
199
call add (Requests, funcref (' s:run.multiple.inBuffer' , [bufnr , tests]))
192
200
endif
193
201
endfor
@@ -232,6 +240,9 @@ function! s:run.multiple.complete(summary) abort
232
240
let pass = 0
233
241
endif
234
242
endfor
243
+ for location in locations
244
+ call s: run .updatestate (location)
245
+ endfor
235
246
if pass
236
247
let title = len (locations) . ' tests passed'
237
248
call s: utils .log .emphasize (title )
@@ -271,6 +282,8 @@ function! s:run.process(Callback, bufnr, tests, response) abort
271
282
for result in a: response .Body.Results
272
283
" Strip namespace and classname from test method name
273
284
let location = {
285
+ \ ' bufnr' : a: bufnr ,
286
+ \ ' fullname' : result.MethodName,
274
287
\ ' filename' : bufname (a: bufnr ),
275
288
\ ' name' : substitute (result.MethodName, ' ^.*\.' , ' ' , ' ' )
276
289
\}
@@ -336,6 +349,16 @@ function! s:run.process(Callback, bufnr, tests, response) abort
336
349
call a: Callback (summary)
337
350
endfunction
338
351
352
+ function ! s: run .updatestate (location) abort
353
+ if get (a: location , ' type' , ' ' ) == # ' E'
354
+ call OmniSharp#testrunner#StateFailed (a: location .bufnr , a: location .fullname)
355
+ elseif get (a: location , ' type' , ' ' ) == # ' W'
356
+ call OmniSharp#testrunner#StateSkipped (a: location .bufnr , a: location .fullname)
357
+ else
358
+ call OmniSharp#testrunner#StatePassed (a: location .bufnr , a: location .fullname)
359
+ endif
360
+ endfunction
361
+
339
362
340
363
function ! OmniSharp#actions#test#Validate () abort
341
364
return s: utils .capabilities ()
0 commit comments