(t *testing.T)
| 118 | } |
| 119 | |
| 120 | func TestFormatWrapf(t *testing.T) { |
| 121 | tests := []struct { |
| 122 | error |
| 123 | format string |
| 124 | want string |
| 125 | }{{ |
| 126 | Wrapf(io.EOF, "error%d", 2), |
| 127 | "%s", |
| 128 | "error2: EOF", |
| 129 | }, { |
| 130 | Wrapf(io.EOF, "error%d", 2), |
| 131 | "%v", |
| 132 | "error2: EOF", |
| 133 | }, { |
| 134 | Wrapf(io.EOF, "error%d", 2), |
| 135 | "%+v", |
| 136 | "EOF\n" + |
| 137 | "error2\n" + |
| 138 | "github.com/pkg/errors.TestFormatWrapf\n" + |
| 139 | "\t.+/github.com/pkg/errors/format_test.go:134", |
| 140 | }, { |
| 141 | Wrapf(New("error"), "error%d", 2), |
| 142 | "%s", |
| 143 | "error2: error", |
| 144 | }, { |
| 145 | Wrapf(New("error"), "error%d", 2), |
| 146 | "%v", |
| 147 | "error2: error", |
| 148 | }, { |
| 149 | Wrapf(New("error"), "error%d", 2), |
| 150 | "%+v", |
| 151 | "error\n" + |
| 152 | "github.com/pkg/errors.TestFormatWrapf\n" + |
| 153 | "\t.+/github.com/pkg/errors/format_test.go:149", |
| 154 | }} |
| 155 | |
| 156 | for i, tt := range tests { |
| 157 | testFormatRegexp(t, i, tt.error, tt.format, tt.want) |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | func TestFormatWithStack(t *testing.T) { |
| 162 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…