cloud-control-panel/example-test/ex_test.go

22 lines
269 B
Go

package ex
import "sync"
import "testing"
type Item struct{}
func TestAppend(t *testing.T) {
var list []Item
n := 2
wg := sync.WaitGroup{}
wg.Add(n)
for i := 0; i < n; i++ {
go func() {
defer wg.Done()
list = append(list, Item{})
}()
}
wg.Wait()
}