Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
27 lines
525 B
Go
27 lines
525 B
Go
package randstr
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestRunesReturnsRequestedLength(t *testing.T) {
|
|
for _, n := range []int{0, 1, 16, 64} {
|
|
got := Runes(n)
|
|
require.Len(t, got, n)
|
|
}
|
|
}
|
|
|
|
func TestRunesUsesOnlyLowercaseLetters(t *testing.T) {
|
|
allowed := make(map[rune]struct{}, len(letterRunes))
|
|
for _, r := range letterRunes {
|
|
allowed[r] = struct{}{}
|
|
}
|
|
|
|
got := Runes(128)
|
|
for _, r := range got {
|
|
_, ok := allowed[r]
|
|
require.Truef(t, ok, "unexpected rune %q in %q", r, got)
|
|
}
|
|
}
|