blob: 839320e4e8a105916acff09f94e12a0a5c23b349 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
[short] skip
[!race] skip
go test -race testrace
-- go.mod --
module testrace
go 1.16
-- race_test.go --
package testrace
import "testing"
func TestRace(t *testing.T) {
helperDone := make(chan struct{})
go func() {
t.Logf("Something happened before cleanup.")
close(helperDone)
}()
t.Cleanup(func() {
<-helperDone
})
}
|