17 lines
237 B
Go
17 lines
237 B
Go
|
package sync
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func TestWaitGroup(t *testing.T) {
|
||
|
wg := NewWaitGroup()
|
||
|
_ = t
|
||
|
wg.Add(1)
|
||
|
ctx, cancel := context.WithTimeout(context.TODO(), 1*time.Second)
|
||
|
defer cancel()
|
||
|
wg.WaitContext(ctx)
|
||
|
}
|