You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running some Go tests through :GoTest and I would expect to see the output in the quickfix window. Instead, the output gets truncated and I get the error message Dropped "[...]" from location list (nonvalid filename) from go#tool#FilterValids.
Steps to reproduce:
The following minimal Go code triggers the described behavior. Run it through :GoTest, see the truncated output in the quickfix window and the error message.
They key point is that the output contains a line break, and the content of the new line looks like what could be a filename followed by a line number.
package main
import (
"testing"
)
funcTestFails(t*testing.T) {
t.Errorf("\n:1:")
}
Note that this is based on a real-world testcase provided by @deltaskelta, I'm just giving a minimal example to reproduce the behavior.
This bug occurs for example when the test output spans multiple lines and contains timestamps, where time values like 15:04:05 look a lot like what could be a filename followed by a line number.
Configuration
vim version: Vim 7.4
vim-go version: vim-go 1.11
go version: Go 1.8
Possible fix
I suppose this is caused by the regex in go#tool#ParseErrors which is a little too broad. It considers every line that begins with colon-number-colon (optional filename and whitespace) to be an error message.
If we would require the filename part to be non-empty in such a way that it at least begins with one non-whitespace character like ^\s*\(\S.\{-}\):\(\d\+\):\s*\(.*\), this works as expected.
I'm not 100% sure though what the idea behind this regex was and if requiring one non-whitespace character in the beginning is actually the best way to go about this, so perhaps someone else can take another look at this. I would suspect that matching could even be restricted to filenames that end in _test.go?
The text was updated successfully, but these errors were encountered:
Yeap, the regex is not perfect, it does the work though. If you have a a fix and provide a foo_test.go file with all the edge cases, I'm happy to merge it.
I've changed the regex to only parse for files that end with .go. This fixes at least your issue. Please pull latest master to get the fix and feel free to open another issue if encounter anything new. Thanks.
Behavior
I'm running some Go tests through
:GoTest
and I would expect to see the output in the quickfix window. Instead, the output gets truncated and I get the error messageDropped "[...]" from location list (nonvalid filename)
fromgo#tool#FilterValids
.Steps to reproduce:
The following minimal Go code triggers the described behavior. Run it through
:GoTest
, see the truncated output in the quickfix window and the error message.They key point is that the output contains a line break, and the content of the new line looks like what could be a filename followed by a line number.
Note that this is based on a real-world testcase provided by @deltaskelta, I'm just giving a minimal example to reproduce the behavior.
This bug occurs for example when the test output spans multiple lines and contains timestamps, where time values like
15:04:05
look a lot like what could be a filename followed by a line number.Configuration
Possible fix
I suppose this is caused by the regex in
go#tool#ParseErrors
which is a little too broad. It considers every line that begins with colon-number-colon (optional filename and whitespace) to be an error message.If we would require the filename part to be non-empty in such a way that it at least begins with one non-whitespace character like
^\s*\(\S.\{-}\):\(\d\+\):\s*\(.*\)
, this works as expected.I'm not 100% sure though what the idea behind this regex was and if requiring one non-whitespace character in the beginning is actually the best way to go about this, so perhaps someone else can take another look at this. I would suspect that matching could even be restricted to filenames that end in
_test.go
?The text was updated successfully, but these errors were encountered: