]> Cypherpunks repositories - gostls13.git/commitdiff
go/printer: simplify test
authorDmitriy Vyukov <dvyukov@google.com>
Fri, 18 Jul 2014 08:44:24 +0000 (12:44 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Fri, 18 Jul 2014 08:44:24 +0000 (12:44 +0400)
Pre Go1?

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/115870043

src/pkg/go/printer/printer_test.go

index 9cab1bee35e9e03fa568a16789af208e7337c0d8..3b0570e5b502a76f4301bf0985e5a35ae7cb61c3 100644 (file)
@@ -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: