cmd/cover: fix race in test

Silly test added yesterday requires that some code in a goroutine executes.
Make sure it does.

Change-Id: I7e852454736e300151473986cc437a70b41dc9b7
Reviewed-on: https://go-review.googlesource.com/7691
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Rob Pike 2015-03-17 06:15:38 -07:00
parent e591801c2d
commit 53f3b29c5d

View File

@ -187,9 +187,12 @@ func testEmptySwitches() {
switch i := (interface{})(3).(int); i { switch i := (interface{})(3).(int); i {
} }
check(LINE, 1) check(LINE, 1)
c := make(chan int)
go func() { go func() {
check(LINE, 1) check(LINE, 1)
c <- 1
select {} select {}
}() }()
<-c
check(LINE, 1) check(LINE, 1)
} }