The core protocol of WoopChain
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.
woop/internal/utils/keylocker/keylocker_test.go

18 lines
331 B

package keylocker
import "testing"
func TestKeyLocker_Sequential(t *testing.T) {
n := New()
key := 1
v := make(chan struct{}, 1)
n.Lock(key, func() (interface{}, error) {
v <- struct{}{}
return nil, nil
})
<-v // we know that goroutine really executed
n.Lock(key, func() (interface{}, error) {
return nil, nil
})
}