Files
rands/randsmust/bytes_test.go
Jim Myhrberg 22fe517baa feat(randsmust): add randsmust package
randsmust is specifically intended as an alternative to rands for use in
tests. All functions return a single value, and panic in the event of an
error. This makes them easy to use when building structs in test cases
that need random data.

Internally the package simply calls the equivalent function from the
rands package, and panics if a error is returned.
2021-12-17 11:03:32 +00:00

20 lines
258 B
Go

package randsmust
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBytes(t *testing.T) {
t.Parallel()
for _, tt := range testCases {
t.Run(tt.name, func(t *testing.T) {
got := Bytes(tt.n)
assert.Len(t, got, tt.n)
})
}
}