mirror of
https://github.com/golang/go
synced 2024-11-12 09:50:21 -07:00
go/printer: simplify test
Pre Go1? LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/115870043
This commit is contained in:
parent
4423222760
commit
5d58033682
@ -159,13 +159,6 @@ func runcheck(t *testing.T, source, golden string, mode checkMode) {
|
||||
}
|
||||
|
||||
func check(t *testing.T, source, golden string, mode checkMode) {
|
||||
// start a timer to produce a time-out signal
|
||||
tc := make(chan int)
|
||||
go func() {
|
||||
time.Sleep(10 * time.Second) // plenty of a safety margin, even for very slow machines
|
||||
tc <- 0
|
||||
}()
|
||||
|
||||
// run the test
|
||||
cc := make(chan int)
|
||||
go func() {
|
||||
@ -173,9 +166,9 @@ func check(t *testing.T, source, golden string, mode checkMode) {
|
||||
cc <- 0
|
||||
}()
|
||||
|
||||
// wait for the first finisher
|
||||
// wait with timeout
|
||||
select {
|
||||
case <-tc:
|
||||
case <-time.After(10 * time.Second): // plenty of a safety margin, even for very slow machines
|
||||
// test running past time out
|
||||
t.Errorf("%s: running too slowly", source)
|
||||
case <-cc:
|
||||
|
Loading…
Reference in New Issue
Block a user