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: allow to run coverage on _test.go files in subdirs #1033

Merged
merged 1 commit into from
Nov 24, 2016
Merged

coverage: allow to run coverage on _test.go files in subdirs #1033

merged 1 commit into from
Nov 24, 2016

Conversation

pborzenkov
Copy link
Contributor

Due to usage of ':t' modifier to extract filename when switching from
file_test.go to file.go, the original path to file is lost and Vim can't
open it if it's stored in some subdir. It only worked by accident if the
file was located in the same directory.

@fatih
Copy link
Owner

fatih commented Sep 4, 2016

Hi @pborzenkov

Thanks for the fix. Much appreciated. Unfortunately I couldn't understand your exact workflow and what this fixes. Can you please provide a step to step example I can try myself to see what the problem is?

@pborzenkov
Copy link
Contributor Author

@fatih Whenever I open test file that is not located in current dir :GoCoverage doesn't work. For example,

vim path/to/some/file_test.go
After that :GoCoverate doesn't work because it's trying to open file.go instead of path/to/some/file.go

@@ -221,6 +221,8 @@ function! go#coverage#overlay(file)
exe ":edit ". fnamemodify(fname, ":p")
endif

let fname = fnamemodify(fname, ":t")
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a comment here why you take the trail of the file (for example because of cov.file ...)

@fatih
Copy link
Owner

fatih commented Nov 23, 2016

@pborzenkov this looks good. Sorry for late review, I was abroad and was very busy.

Due to usage of ':t' modifier to extract filename when switching from
file_test.go to file.go, the original path to file is lost and Vim can't
open it if it's stored in some subdir. It only worked by accident if the
file was located in the same directory.
@fatih fatih merged commit b84f01a into fatih:master Nov 24, 2016
@pborzenkov pborzenkov deleted the coverage branch November 24, 2016 17:32
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