(t *testing.T)
| 159 | } |
| 160 | |
| 161 | func TestFormatWithStack(t *testing.T) { |
| 162 | tests := []struct { |
| 163 | error |
| 164 | format string |
| 165 | want []string |
| 166 | }{{ |
| 167 | WithStack(io.EOF), |
| 168 | "%s", |
| 169 | []string{"EOF"}, |
| 170 | }, { |
| 171 | WithStack(io.EOF), |
| 172 | "%v", |
| 173 | []string{"EOF"}, |
| 174 | }, { |
| 175 | WithStack(io.EOF), |
| 176 | "%+v", |
| 177 | []string{"EOF", |
| 178 | "github.com/pkg/errors.TestFormatWithStack\n" + |
| 179 | "\t.+/github.com/pkg/errors/format_test.go:175"}, |
| 180 | }, { |
| 181 | WithStack(New("error")), |
| 182 | "%s", |
| 183 | []string{"error"}, |
| 184 | }, { |
| 185 | WithStack(New("error")), |
| 186 | "%v", |
| 187 | []string{"error"}, |
| 188 | }, { |
| 189 | WithStack(New("error")), |
| 190 | "%+v", |
| 191 | []string{"error", |
| 192 | "github.com/pkg/errors.TestFormatWithStack\n" + |
| 193 | "\t.+/github.com/pkg/errors/format_test.go:189", |
| 194 | "github.com/pkg/errors.TestFormatWithStack\n" + |
| 195 | "\t.+/github.com/pkg/errors/format_test.go:189"}, |
| 196 | }, { |
| 197 | WithStack(WithStack(io.EOF)), |
| 198 | "%+v", |
| 199 | []string{"EOF", |
| 200 | "github.com/pkg/errors.TestFormatWithStack\n" + |
| 201 | "\t.+/github.com/pkg/errors/format_test.go:197", |
| 202 | "github.com/pkg/errors.TestFormatWithStack\n" + |
| 203 | "\t.+/github.com/pkg/errors/format_test.go:197"}, |
| 204 | }, { |
| 205 | WithStack(WithStack(Wrapf(io.EOF, "message"))), |
| 206 | "%+v", |
| 207 | []string{"EOF", |
| 208 | "message", |
| 209 | "github.com/pkg/errors.TestFormatWithStack\n" + |
| 210 | "\t.+/github.com/pkg/errors/format_test.go:205", |
| 211 | "github.com/pkg/errors.TestFormatWithStack\n" + |
| 212 | "\t.+/github.com/pkg/errors/format_test.go:205", |
| 213 | "github.com/pkg/errors.TestFormatWithStack\n" + |
| 214 | "\t.+/github.com/pkg/errors/format_test.go:205"}, |
| 215 | }, { |
| 216 | WithStack(Errorf("error%d", 1)), |
| 217 | "%+v", |
| 218 | []string{"error1", |
nothing calls this directly
no test coverage detected
searching dependent graphs…