mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
21 lines
299 B
Go
21 lines
299 B
Go
package semerrgroup
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestSemaphore(t *testing.T) {
|
|
var g = New(1)
|
|
var counter = 0
|
|
for i := 0; i < 10; i++ {
|
|
g.Go(func() error {
|
|
counter++
|
|
return nil
|
|
})
|
|
}
|
|
require.NoError(t, g.Wait())
|
|
require.Equal(t, counter, 10)
|
|
}
|