TestWaitGroup tests the typical usage of WaitGroup.
(t *testing.T)
| 24 | |
| 25 | // TestWaitGroup tests the typical usage of WaitGroup. |
| 26 | func TestWaitGroup(t *testing.T) { |
| 27 | const n = 5 |
| 28 | var wg sync.WaitGroup |
| 29 | wg.Add(n) |
| 30 | for i := 0; i < n; i++ { |
| 31 | go wg.Done() |
| 32 | } |
| 33 | |
| 34 | wg.Wait() |
| 35 | } |