File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -7,23 +7,26 @@ package syncutil
77import (
88 "sync"
99 "testing"
10+ "testing/synctest"
1011 "time"
1112)
1213
1314func TestWaitWithTimeout (t * testing.T ) {
1415 var wg sync.WaitGroup
1516
16- if ! WaitWithTimeout (& wg , 10 * time .Millisecond ) {
17- t .Fatal ("want timeout; have none" )
18- }
17+ synctest .Test (t , func (t * testing.T ) {
18+ if ! WaitWithTimeout (& wg , 10 * time .Millisecond ) {
19+ t .Fatal ("want timeout; have none" )
20+ }
1921
20- wg .Add (1 )
21- if WaitWithTimeout (& wg , 10 * time .Millisecond ) {
22- t .Fatal ("have timeout; want none" )
23- }
22+ wg .Add (1 )
23+ if WaitWithTimeout (& wg , 10 * time .Millisecond ) {
24+ t .Fatal ("have timeout; want none" )
25+ }
2426
25- wg .Done ()
26- if ! WaitWithTimeout (& wg , 10 * time .Millisecond ) {
27- t .Fatal ("want no timeout; have none" )
28- }
27+ wg .Done ()
28+ if ! WaitWithTimeout (& wg , 10 * time .Millisecond ) {
29+ t .Fatal ("want no timeout; have none" )
30+ }
31+ })
2932}
You can’t perform that action at this time.
0 commit comments