Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
Added more Stack tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davecheney committed May 23, 2016
1 parent cc157cd commit abe54b4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@ func TestStack(t *testing.T) {
Cause(Wrap(New("ooh"), "ahh")), []fileline{
{"github.com/pkg/errors/errors_test.go", 208}, // this is the stack of New
},
}, {
func() error { return New("ooh") }(), []fileline{
{"github.com/pkg/errors/errors_test.go", 212}, // this is the stack of New
{"github.com/pkg/errors/errors_test.go", 212}, // this is the stack of New's caller
},
}, {
Cause(func() error {
return func() error {
return Errorf("hello %s", fmt.Sprintf("world"))
}()
}()), []fileline{
{"github.com/pkg/errors/errors_test.go", 219}, // this is the stack of Errorf
{"github.com/pkg/errors/errors_test.go", 220}, // this is the stack of Errorf's caller
{"github.com/pkg/errors/errors_test.go", 221}, // this is the stack of Errorf's caller's caller
},
}}
for _, tt := range tests {
x, ok := tt.err.(interface {
Expand Down

0 comments on commit abe54b4

Please sign in to comment.