(c *gc.C)
| 304 | } |
| 305 | |
| 306 | func (*functionSuite) TestFormat(c *gc.C) { |
| 307 | formatErrorExpected := &strings.Builder{} |
| 308 | err := errors.New("TestFormat") |
| 309 | fmt.Fprintf(formatErrorExpected, "%s: TestFormat\n", errorLocationValue(c)) |
| 310 | err = errors.Mask(err) |
| 311 | fmt.Fprintf(formatErrorExpected, "%s: ", errorLocationValue(c)) |
| 312 | |
| 313 | for i, test := range []struct { |
| 314 | format string |
| 315 | expect string |
| 316 | }{{ |
| 317 | format: "%s", |
| 318 | expect: "TestFormat", |
| 319 | }, { |
| 320 | format: "%v", |
| 321 | expect: "TestFormat", |
| 322 | }, { |
| 323 | format: "%q", |
| 324 | expect: `"TestFormat"`, |
| 325 | }, { |
| 326 | format: "%A", |
| 327 | expect: `%!A(*errors.Err=TestFormat)`, |
| 328 | }, { |
| 329 | format: "%+v", |
| 330 | expect: formatErrorExpected.String(), |
| 331 | }} { |
| 332 | c.Logf("test %d: %q", i, test.format) |
| 333 | s := fmt.Sprintf(test.format, err) |
| 334 | c.Check(s, gc.Equals, test.expect) |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | type basicError struct { |
| 339 | Reason string |
nothing calls this directly
no test coverage detected