Skip to content

Commit

Permalink
Correctly run multiple NUnit tests (RunInFile)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickspoons committed Oct 29, 2022
1 parent a4401d3 commit dbabeb6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions autoload/OmniSharp/actions/test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,19 @@ function! s:run.single.test(testName, bufferTests) abort
let currentTest = currentTest[0]
let project = OmniSharp#GetHost(bufnr).project
let targetFramework = project.MsBuildProject.TargetFramework
let currentTestName = substitute(currentTest.name, '(.*)$', '', '')
let opts = {
\ 'ResponseHandler': funcref('s:run.process', [s:run.single.complete, bufnr, tests]),
\ 'BufNum': bufnr,
\ 'Parameters': {
\ 'MethodName': substitute(currentTest.name, '(.*)$', '', ''),
\ 'MethodName': currentTestName,
\ 'NoBuild': get(s:, 'nobuild', 0),
\ 'TestFrameworkName': currentTest.framework,
\ 'TargetFrameworkVersion': targetFramework
\ },
\ 'SendBuffer': 0
\}
echomsg 'Running test ' . currentTest.name
echomsg 'Running test ' . currentTestName
call OmniSharp#stdio#Request('/v2/runtest', opts)
endfunction

Expand Down Expand Up @@ -243,7 +244,7 @@ function! s:run.multiple.inBuffer(bufnr, tests, Callback) abort
\ 'ResponseHandler': funcref('s:run.process', [a:Callback, a:bufnr, a:tests]),
\ 'BufNum': a:bufnr,
\ 'Parameters': {
\ 'MethodNames': map(copy(a:tests), {i,t -> t.name}),
\ 'MethodNames': map(copy(a:tests), {i,t -> substitute(t.name, '(.*)$', '', '')}),
\ 'NoBuild': get(s:, 'nobuild', 0),
\ 'TestFrameworkName': a:tests[0].framework,
\ 'TargetFrameworkVersion': targetFramework
Expand Down Expand Up @@ -427,7 +428,6 @@ function! s:utils.extractTests(bufnr, codeElements) abort
let testStart = min(filter(copy(testlines), {_,l -> l >= testStart}))
for dt in OmniSharp#GetHost(a:bufnr).project.tests
if dt.CodeFilePath ==# filename && dt.LineNumber == testStart
" \ 'name': element.Properties.testMethodName,
call add(tests, {
\ 'name': dt.FullyQualifiedName,
\ 'framework': element.Properties.testFramework,
Expand Down

0 comments on commit dbabeb6

Please sign in to comment.