1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00
goreleaser/internal/gio/safe_test.go
Carlos Alexandro Becker bf19dc1079
feat: moving some cmd logs to debug (#2359)
* 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>
2021-07-23 12:09:29 +01:00

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