1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/semaphore/sem_test.go

21 lines
280 B
Go
Raw Normal View History

package semaphore
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestSemaphore(t *testing.T) {
var sem = New(1)
var counter = 0
for i := 0; i < 10; i++ {
sem.Acquire()
go func() {
counter++
sem.Release()
}()
}
require.Equal(t, counter, 9)
}