diff options
author | Jean de Klerk <deklerk@google.com> | 2020-06-01 12:19:05 -0600 |
---|---|---|
committer | Jean de Klerk <deklerk@google.com> | 2020-06-02 22:57:03 +0000 |
commit | ba6ccf3b04cbda5ac19412c933c69425ca828bfa (patch) | |
tree | 2f004ba3c527b85efa36c06d33c8b11a23663fac /src/testing | |
parent | a9cc1051c11f821cb03d63fb9e05930f9e2f9fa5 (diff) | |
download | go-ba6ccf3b04cbda5ac19412c933c69425ca828bfa.tar.gz go-ba6ccf3b04cbda5ac19412c933c69425ca828bfa.zip |
testing: capture testname on --- PASS and --- FAIL lines
This fixes an issue raised at https://github.com/golang/go/issues/38458#issuecomment-635617670
in which --- PASS and --- FAIL lines would not trigger --- CONT lines
of other tests.
Change-Id: I0d8cc54d682a370d0a6ea6816a11b2e462a92efe
Reviewed-on: https://go-review.googlesource.com/c/go/+/235997
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go index 4a14d49a91..85da6bb02a 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -353,15 +353,14 @@ func (p *testPrinter) Print(testName, out string) { } func (p *testPrinter) Fprint(w io.Writer, testName, out string) { - if !p.chatty || strings.HasPrefix(out, "--- PASS") || strings.HasPrefix(out, "--- FAIL") { - fmt.Fprint(w, out) - return - } - p.lastNameMu.Lock() defer p.lastNameMu.Unlock() - if strings.HasPrefix(out, "=== CONT") || strings.HasPrefix(out, "=== RUN") { + if !p.chatty || + strings.HasPrefix(out, "--- PASS") || + strings.HasPrefix(out, "--- FAIL") || + strings.HasPrefix(out, "=== CONT") || + strings.HasPrefix(out, "=== RUN") { p.lastName = testName fmt.Fprint(w, out) return |