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
Carlos Alexandro Becker 58d71a1c95
refactor: add a semaphore lib
Simple lib for better semaphore semanthics.
2018-06-25 17:00:00 -03:00

21 lines
280 B
Go

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)
}