@@ -197,61 +197,6 @@ func TestErrorf(t *testing.T) {
197197 }
198198}
199199
200- func TestStack (t * testing.T ) {
201- type fileline struct {
202- file string
203- line int
204- }
205- tests := []struct {
206- err error
207- want []fileline
208- }{{
209- New ("ooh" ), []fileline {
210- {"github.com/pkg/errors/errors_test.go" , 209 },
211- },
212- }, {
213- Wrap (New ("ooh" ), "ahh" ), []fileline {
214- {"github.com/pkg/errors/errors_test.go" , 213 }, // this is the stack of Wrap, not New
215- },
216- }, {
217- Cause (Wrap (New ("ooh" ), "ahh" )), []fileline {
218- {"github.com/pkg/errors/errors_test.go" , 217 }, // this is the stack of New
219- },
220- }, {
221- func () error { return New ("ooh" ) }(), []fileline {
222- {"github.com/pkg/errors/errors_test.go" , 221 }, // this is the stack of New
223- {"github.com/pkg/errors/errors_test.go" , 221 }, // this is the stack of New's caller
224- },
225- }, {
226- Cause (func () error {
227- return func () error {
228- return Errorf ("hello %s" , fmt .Sprintf ("world" ))
229- }()
230- }()), []fileline {
231- {"github.com/pkg/errors/errors_test.go" , 228 }, // this is the stack of Errorf
232- {"github.com/pkg/errors/errors_test.go" , 229 }, // this is the stack of Errorf's caller
233- {"github.com/pkg/errors/errors_test.go" , 230 }, // this is the stack of Errorf's caller's caller
234- },
235- }}
236- for _ , tt := range tests {
237- x , ok := tt .err .(interface {
238- Stack () []uintptr
239- })
240- if ! ok {
241- t .Errorf ("expected %#v to implement Stack()" , tt .err )
242- continue
243- }
244- st := x .Stack ()
245- for i , want := range tt .want {
246- frame := Frame (st [i ])
247- file , line := fmt .Sprintf ("%+s" , frame ), frame .line ()
248- if file != want .file || line != want .line {
249- t .Errorf ("frame %d: expected %s:%d, got %s:%d" , i , want .file , want .line , file , line )
250- }
251- }
252- }
253- }
254-
255200// errors.New, etc values are not expected to be compared by value
256201// but the change in errors#27 made them incomparable. Assert that
257202// various kinds of errors have a functional equality operator, even
0 commit comments