Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage.vim: pass along arguments to coverage_job #1326

Merged
merged 1 commit into from
Jun 9, 2017

Conversation

tmc
Copy link
Contributor

@tmc tmc commented Jun 8, 2017

This allows things like :GoCoverage -run TestSpecific which allows you to see the exact coverage for a test/subtest.

It looks like this was the intent but may have been missed in dc80733

@tmc
Copy link
Contributor Author

tmc commented Jun 8, 2017

refs #1196

@@ -46,7 +46,7 @@ function! go#coverage#Buffer(bang, ...) abort

if go#util#has_job()
call s:coverage_job({
\ 'cmd': ['go', 'test', '-coverprofile', l:tmpname],
\ 'cmd': ['go', 'test', '-coverprofile', l:tmpname] + a:000,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I don't pass anything? What is the value of a:000? How does coverage look like for a single function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first vimscript I've written.

a:000 is '[]' by default:

:breakadd func 24 go#coverage#Buffer
:debug GoCoverage

>cont
Breakpoint in "go#coverage#Buffer" line 24
function go#coverage#Buffer
line 24: if go#util#has_job()
>echo a:000
[]
>n
function go#coverage#Buffer
line 25: call s:coverage_job({ 'cmd': ['go', 'test', '-coverprofile', l:tmpname] + a:000, 'custom_cb': function('s:coverage_callback', [l:tmpname]), 'bang': a:bang, })
>echo ['go', 'test', '-coverprofile', l:tmpname] + a:000
['go', 'test', '-coverprofile', '/var/folders/3j/pjbjsn3x5vjf20fl1qb_q8z00000gn/T/vuMXJDi/78']
>echo ['go', 'test', '-coverprofile', l:tmpname]
['go', 'test', '-coverprofile', '/var/folders/3j/pjbjsn3x5vjf20fl1qb_q8z00000gn/T/vuMXJDi/78']
>echo a:000
[]
>

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and how does it look like inside Vim ? Can you add a screenshot?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visually it looks the same as :GoCoverage -- it will instead only show lines covered by the particular test(s) run.

@fatih fatih merged commit 91b159a into fatih:master Jun 9, 2017
@fatih
Copy link
Owner

fatih commented Jun 9, 2017

Thanks @tmc , looks good 👍

@tmc tmc deleted the coverage-args branch October 3, 2017 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants