-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
improve test output handling #1513
Conversation
autoload/go/test.vim
Outdated
let tokens = matchlist(line, '^\t\+\(.\{-}\.go\):\(\d\+\) \(+0x.*\)') | ||
else | ||
let tokens = matchlist(line, '^ *\t\+\(.\{-}\.go\):\(\d\+\):\s*\(.*\)') | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add as a comment above the let tokens ...
lines what exactly it parses? Such as : foo.go:1:15 msg
It's would make reading the regexp easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The latest commit, PTAL |
I think this would be an excellent patch to add some tests for, so we can be sure that all scenarios work :-) |
I agree, but I've yet to dive in to see how to write tests for VimL. Do you want to wait to merge this until those tests are written? |
Don't need to; just would be nice :-) Writing tests is actually easier than I thought it would be, I have some work on making it easier (and documenting how to do it) in this branch (which depends on #1476). I'd be happy to add tests for this (either before or after it's merged). |
Yeah, I was kind of hoping to review that PR before I write tests for this, but I agree that we should add test coverage for this. #1476 is big enough that I plan to use reviewing it as a good excuse write tests for this while reviewing it in order to understand exactly what #1476 does and what the experience it brings to testing will be like. |
@fatih can you review |
9e56464
to
f747c96
Compare
Here's a tarball with tests that produce:
|
f747c96
to
260f7c2
Compare
@fatih does the comment I added address your concerns? @Carpetsmoker you had mentioned that you may add tests for this; have you made any progress? I'd really like to get this merged, as I run into the issues it addresses daily. |
Yes, I wanted to do that but got side-tracked with some other stuff and never got 'round to it, and it's not likely that I will in the coming week either. If it's fixing a real problem for you then feel free to merge; don't need to add tests, just would be nice :-) |
* Use stricter regular expression to correctly identify potential file references in test output. When `go test` outputs a test failure file location, the file is preceded with at least one tab. If there is leading space on the line, then it's a subtest that failed. Use that to more accurately disregard lines that will not refer to files. * Preserve multi-line test failure output by similarly checking for at least one tab ahead of the output. * Preserve output that seemingly *should* refer to a file, but for whatever does not, but don't make it a file reference for the purposes of quickfix and location lists. * Preserve all lines of stack traces. * Correctly recognize file locations in stack traces.
260f7c2
to
57ac640
Compare
SGTM I'll work on adding tests separately. |
Use stricter regular expression to correctly identify potential file
references in test output. When
go test
outputs a test failure filelocation, the file is preceded with at least one tab. If there is
leading space on the line, then it's a subtest that failed. Use that
to more accurately disregard lines that will not refer to files.
Preserve multi-line test failure output by similarly checking for at
least one tab ahead of the output.
Preserve output that seemingly should refer to a file, but for
whatever does not, but don't make it a file reference for the purposes
of quickfix and location lists.
Preserve all lines of stack traces.
Correctly recognize file locations in stack traces.
Fixes #1179 and at least partially addresses #1493.