1 package xrand_test 2 3 import ( 4 "testing" 5 6 "oss.terrastruct.com/util-go/xrand" 7 ) 8 9 func TestString(t *testing.T) { 10 t.Parallel() 11 12 t.Run("invalids", func(t *testing.T) { 13 t.Parallel() 14 15 s := xrand.String(0, nil) 16 if s != "" { 17 t.Fatalf("expected empty string: %q", s) 18 } 19 s = xrand.String(-1, nil) 20 if s != "" { 21 t.Fatalf("expected empty string: %q", s) 22 } 23 }) 24 25 s := xrand.String(20, nil) 26 t.Logf("%d %s", len(s), s) 27 } 28