MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestMultiError_Err

Function TestMultiError_Err

pkg/util/multierror/multierror_test.go:64–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestMultiError_Err(t *testing.T) {
65 tests := []struct {
66 name string
67 errs []error
68 expectNil bool
69 }{
70 {
71 name: "empty returns nil",
72 errs: nil,
73 expectNil: true,
74 },
75 {
76 name: "with errors returns non-nil",
77 errs: []error{errors.New("err1")},
78 expectNil: false,
79 },
80 }
81
82 for _, tt := range tests {
83 t.Run(tt.name, func(t *testing.T) {
84 me := New(tt.errs...)
85 result := me.Err()
86 if tt.expectNil {
87 assert.NoError(t, result)
88 } else {
89 assert.Error(t, result)
90 }
91 })
92 }
93}
94
95func TestNonNilMultiError_Error(t *testing.T) {
96 tests := []struct {

Callers

nothing calls this directly

Calls 4

NewFunction · 0.70
RunMethod · 0.65
ErrMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected