mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-03 18:42:14 +00:00
## Description Internalize some libs. This reduces the amount ot public API tendermint is supporting. The moved libraries are mainly ones that are used within Tendermint-core.
29 lines
414 B
Go
29 lines
414 B
Go
package sync_test
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
tmsync "github.com/tendermint/tendermint/internal/libs/sync"
|
|
)
|
|
|
|
func TestCloser(t *testing.T) {
|
|
closer := tmsync.NewCloser()
|
|
|
|
var timeout bool
|
|
|
|
select {
|
|
case <-closer.Done():
|
|
case <-time.After(time.Second):
|
|
timeout = true
|
|
}
|
|
|
|
for i := 0; i < 10; i++ {
|
|
closer.Close()
|
|
}
|
|
|
|
require.True(t, timeout)
|
|
<-closer.Done()
|
|
}
|