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

Function TestNew

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

Source from the content-addressed store, hash-verified

126}
127
128func TestNew(t *testing.T) {
129 tests := []struct {
130 name string
131 errs []error
132 expected int
133 }{
134 {
135 name: "no arguments",
136 errs: nil,
137 expected: 0,
138 },
139 {
140 name: "nil errors are filtered out",
141 errs: []error{nil, nil},
142 expected: 0,
143 },
144 {
145 name: "mixed nil and non-nil",
146 errs: []error{nil, errors.New("err1"), nil, errors.New("err2")},
147 expected: 2,
148 },
149 }
150
151 for _, tt := range tests {
152 t.Run(tt.name, func(t *testing.T) {
153 me := New(tt.errs...)
154 assert.Len(t, me, tt.expected)
155 })
156 }
157}

Callers

nothing calls this directly

Calls 3

NewFunction · 0.70
RunMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected