MCPcopy
hub / github.com/apache/devlake / TestRandLetterBytes

Function TestRandLetterBytes

backend/core/utils/strings_test.go:27–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestRandLetterBytes(t *testing.T) {
28 type args struct {
29 n int
30 }
31 tests := []struct {
32 name string
33 args args
34 want1 errors.Error
35 }{
36 {
37 "test1",
38 args{0},
39 nil,
40 },
41 {
42 "test1",
43 args{-1},
44 errors.Default.New("n must be greater than 0"),
45 },
46 {
47 "test2",
48 args{10},
49 nil,
50 },
51 {
52 "test3",
53 args{128},
54 nil,
55 },
56 }
57 for _, tt := range tests {
58 t.Run(tt.name, func(t *testing.T) {
59 got, got1 := RandLetterBytes(tt.args.n)
60 t.Log(got)
61 assert.Equalf(t, tt.want1, got1, "RandLetterBytes(%v)", tt.args.n)
62 })
63 }
64}
65
66func TestSanitizeString(t *testing.T) {
67 type args struct {

Callers

nothing calls this directly

Calls 4

RandLetterBytesFunction · 0.85
RunMethod · 0.80
NewMethod · 0.65
LogMethod · 0.65

Tested by

no test coverage detected