-
Notifications
You must be signed in to change notification settings - Fork 17.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing: treat PAUSE lines as changing the active test name
We could instead fix cmd/test2json to treat PAUSE lines as *not* changing the active test name, but that seems like it would be more confusing to humans, and also wouldn't fix tools that parse output using existing builds of cmd/test2json. Fixes #40657 Change-Id: I937611778f5b1e7dd1d6e9f44424d7e725a589ed Reviewed-on: https://go-review.googlesource.com/c/go/+/248727 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jean de Klerk <deklerk@google.com>
- Loading branch information
Bryan C. Mills
committed
Aug 18, 2020
1 parent
93eeb81
commit cdc77d3
Showing
2 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Regression test for https://golang.org/issue/40657: output from the main test | ||
# function should be attributed correctly even if interleaved with the PAUSE | ||
# line for a new parallel subtest. | ||
|
||
[short] skip | ||
|
||
go test -json | ||
stdout '"Test":"TestWeirdTiming","Output":"[^"]* logging to outer again\\n"' | ||
|
||
-- go.mod -- | ||
module example.com | ||
go 1.15 | ||
-- main_test.go -- | ||
package main | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestWeirdTiming(outer *testing.T) { | ||
outer.Run("pauser", func(pauser *testing.T) { | ||
outer.Logf("logging to outer") | ||
pauser.Parallel() | ||
}) | ||
|
||
outer.Logf("logging to outer again") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters