mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
bf19dc1079
* feat: moving some cmd logs to debug Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * feat: moving some cmd logs to debug Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
31 lines
413 B
Go
31 lines
413 B
Go
package gio
|
|
|
|
import (
|
|
"bytes"
|
|
"sync"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestSafe(t *testing.T) {
|
|
chars := 30
|
|
|
|
var b bytes.Buffer
|
|
w := Safe(&b)
|
|
|
|
var wg sync.WaitGroup
|
|
wg.Add(chars)
|
|
for i := 0; i < chars; i++ {
|
|
go func() {
|
|
s, err := w.Write([]byte("a"))
|
|
require.Equal(t, 1, s)
|
|
require.NoError(t, err)
|
|
wg.Done()
|
|
}()
|
|
}
|
|
wg.Wait()
|
|
|
|
require.Len(t, b.String(), chars)
|
|
}
|