MCPcopy
hub / github.com/smallstep/cli / TestReadAll

Function TestReadAll

utils/read_test.go:68–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestReadAll(t *testing.T) {
69 content := []byte("read all this")
70
71 type args struct {
72 r io.Reader
73 }
74 tests := []struct {
75 name string
76 args args
77 want []byte
78 wantErr bool
79 }{
80 {"ok", args{bytes.NewReader(content)}, content, false},
81 {"fail", args{&mockReader{err: fmt.Errorf("this is an error")}}, []byte{}, true},
82 }
83 for _, tt := range tests {
84 t.Run(tt.name, func(t *testing.T) {
85 got, err := ReadAll(tt.args.r)
86 if (err != nil) != tt.wantErr {
87 t.Errorf("ReadAll() error = %v, wantErr %v", err, tt.wantErr)
88 return
89 }
90 if !reflect.DeepEqual(got, tt.want) {
91 t.Errorf("ReadAll() = %v, want %v", got, tt.want)
92 }
93 })
94 }
95}
96
97func TestReadString(t *testing.T) {
98 c1 := []byte("read all this")

Callers

nothing calls this directly

Calls 2

ReadAllFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…