@@ -41,7 +41,9 @@ function! OmniSharp#testrunner#Run() abort
41
41
for sln_or_dir in OmniSharp#proc#ListRunningJobs ()
42
42
let job = OmniSharp#proc#GetJob (sln_or_dir)
43
43
if has_key (job, ' tests' ) && has_key (job.tests, projectname)
44
- call OmniSharp#actions#test#RunInFile (1 , keys (job.tests[projectname]))
44
+ let filenames = filter (keys (job.tests[projectname]),
45
+ \ {_,f - > ! get (job.tests[projectname][f ], ' __OmniSharp__removed' )})
46
+ call OmniSharp#actions#test#RunInFile (1 , filenames)
45
47
endif
46
48
endfor
47
49
elseif line = ~# ' ^ \f'
@@ -58,6 +60,39 @@ function! OmniSharp#testrunner#Run() abort
58
60
endfunction
59
61
60
62
63
+ function ! OmniSharp#testrunner#Remove () abort
64
+ let filename = ' '
65
+ let line = getline (' .' )
66
+ if line = ~# ' ^\a'
67
+ " Project selected - run all tests
68
+ let projectname = getline (' .' )
69
+ for sln_or_dir in OmniSharp#proc#ListRunningJobs ()
70
+ let job = OmniSharp#proc#GetJob (sln_or_dir)
71
+ if has_key (job, ' tests' ) && has_key (job.tests, projectname)
72
+ let job.tests[projectname].__OmniSharp__removed = 1
73
+ break
74
+ endif
75
+ endfor
76
+ elseif line = ~# ' ^ \f'
77
+ " File selected
78
+ let filename = fnamemodify (trim (line ), ' :p' )
79
+ let projectline = search (' ^\a' , ' bcnWz' )
80
+ let projectname = matchlist (getline (projectline), ' ^\S\+' )[0 ]
81
+ for sln_or_dir in OmniSharp#proc#ListRunningJobs ()
82
+ let job = OmniSharp#proc#GetJob (sln_or_dir)
83
+ if has_key (job, ' tests' ) && has_key (job.tests, projectname)
84
+ let job.tests[projectname][filename].__OmniSharp__removed = 1
85
+ break
86
+ endif
87
+ endfor
88
+ else
89
+ let test = s: utils .findTest ()
90
+ let test.__OmniSharp__removed = 1
91
+ endif
92
+ call s: Paint ()
93
+ endfunction
94
+
95
+
61
96
function ! OmniSharp#testrunner#Navigate () abort
62
97
if &filetype !=# ' omnisharptest' | return | endif
63
98
let bufnr = -1
@@ -185,6 +220,7 @@ function! s:Paint() abort
185
220
let job = OmniSharp#proc#GetJob (sln_or_dir)
186
221
if ! has_key (job, ' tests' ) | continue | endif
187
222
for testproject in sort (keys (job.tests))
223
+ if get (job.tests[testproject], ' __OmniSharp__removed' ) | continue | endif
188
224
let errors = get (get (job, ' testerrors' , {}), testproject, [])
189
225
call add (lines , testproject . (len (errors) ? ' - ERROR' : ' ' ))
190
226
for errorline in errors
@@ -204,10 +240,12 @@ function! s:Paint() abort
204
240
endif
205
241
endif
206
242
for testfile in sort (keys (job.tests[testproject]))
207
- call add (lines , ' ' . fnamemodify (testfile, ' :.' ))
208
243
let tests = job.tests[testproject][testfile]
244
+ if get (tests, ' __OmniSharp__removed' ) | continue | endif
245
+ call add (lines , ' ' . fnamemodify (testfile, ' :.' ))
209
246
for name in sort (keys (tests), {a ,b - > tests[a ].lnum > tests[b ].lnum})
210
247
let test = tests[name]
248
+ if get (test, ' __OmniSharp__removed' ) | continue | endif
211
249
let state = s: utils .state2char[test.state ]
212
250
call add (lines , printf (' %s %s' , state , name))
213
251
if state == # ' -' && ! has_key (test, ' spintimer' )
@@ -284,15 +322,25 @@ function! OmniSharp#testrunner#SetTests(bufferTests) abort
284
322
let job.tests = get (job, ' tests' , {})
285
323
let projectname = s: utils .getProjectName (buffer .bufnr )
286
324
let testproject = get (job.tests, projectname, {})
325
+ if has_key (testproject, ' __OmniSharp__removed' )
326
+ unlet testproject.__OmniSharp__removed
327
+ endif
287
328
let job.tests[projectname] = testproject
288
329
let filename = fnamemodify (bufname (buffer .bufnr ), ' :p' )
289
330
let filetests = get (testproject, filename, {})
331
+ if has_key (testproject, ' __OmniSharp__removed' )
332
+ unlet testproject.__OmniSharp__removed
333
+ endif
290
334
let testproject[filename] = filetests
291
335
for buffertest in buffer .tests
292
336
let test = get (filetests, buffertest.name, { ' state' : ' Not run' })
337
+ if has_key (test, ' __OmniSharp__removed' )
338
+ unlet test.__OmniSharp__removed
339
+ endif
293
340
let filetests[buffertest.name] = test
294
341
let test.name = buffertest.name
295
342
let test.filename = filename
343
+ let test.projectname = projectname
296
344
let test.framework = buffertest.framework
297
345
let test.lnum = buffertest.nameRange.Start.Line
298
346
endfor
0 commit comments