TestFormat checks edge cases of the utilities in this package. More tests are exercised in the "fmttests" package.
(t *testing.T)
| 29 | // TestFormat checks edge cases of the utilities in this package. |
| 30 | // More tests are exercised in the "fmttests" package. |
| 31 | func TestFormat(t *testing.T) { |
| 32 | tt := testutils.T{t} |
| 33 | |
| 34 | testCases := []struct { |
| 35 | name string |
| 36 | err error |
| 37 | expFmtSimple string |
| 38 | expFmtVerbose string |
| 39 | }{ |
| 40 | {"newf-empty", |
| 41 | errutil.Newf(emptyString), |
| 42 | ``, ` |
| 43 | |
| 44 | (1) attached stack trace |
| 45 | -- stack trace: |
| 46 | | github.com/cockroachdb/errors/errutil_test.TestFormat |
| 47 | | <tab><path> |
| 48 | | testing.tRunner |
| 49 | | <tab><path> |
| 50 | | runtime.goexit |
| 51 | | <tab><path> |
| 52 | Wraps: (2) |
| 53 | Error types: (1) *withstack.withStack (2) *errutil.leafError`, |
| 54 | }, |
| 55 | |
| 56 | {"newf-empty-arg", |
| 57 | errutil.Newf(emptyString, 123), |
| 58 | `%!(EXTRA int=123)`, ` |
| 59 | %!(EXTRA int=123) |
| 60 | (1) attached stack trace |
| 61 | -- stack trace: |
| 62 | | github.com/cockroachdb/errors/errutil_test.TestFormat |
| 63 | | <tab><path> |
| 64 | | testing.tRunner |
| 65 | | <tab><path> |
| 66 | | runtime.goexit |
| 67 | | <tab><path> |
| 68 | Wraps: (2) %!(EXTRA int=123) |
| 69 | Error types: (1) *withstack.withStack (2) *errutil.leafError`, |
| 70 | }, |
| 71 | |
| 72 | {"wrapf-empty", |
| 73 | errutil.Wrapf(goErr.New("woo"), emptyString), |
| 74 | `woo`, ` |
| 75 | woo |
| 76 | (1) attached stack trace |
| 77 | -- stack trace: |
| 78 | | github.com/cockroachdb/errors/errutil_test.TestFormat |
| 79 | | <tab><path> |
| 80 | | testing.tRunner |
| 81 | | <tab><path> |
| 82 | | runtime.goexit |
| 83 | | <tab><path> |
| 84 | Wraps: (2) woo |
| 85 | Error types: (1) *withstack.withStack (2) *errors.errorString`, |
| 86 | }, |
| 87 | |
| 88 | {"wrapf-empty-arg", |
nothing calls this directly
no test coverage detected
searching dependent graphs…