Fast Link Checker for Markdown and HTML in Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
382 B

package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewSemaphore(t *testing.T) {
newSemaphore(1)
}
func TestSemaphoreRequest(t *testing.T) {
s := newSemaphore(1)
s.Request()
assert.Equal(t, 1, len(s.channel))
}
func TestSemaphoreRelease(t *testing.T) {
s := newSemaphore(1)
s.Request()
s.Release()
assert.Equal(t, 0, len(s.channel))
}