@@ -119,20 +119,29 @@ func TestFprintError(t *testing.T) {
119119 want : "EOF\n " ,
120120 }, {
121121 // caused error returns cause
122- err : & causeError {cause : io .EOF },
123- want : "cause error\n EOF\n " ,
122+ err : & causeError {cause : io .EOF },
123+ want : "EOF\n " +
124+ "cause error\n " ,
124125 }, {
125126 err : x , // return from errors.New
126127 want : "github.com/pkg/errors/errors_test.go:106: error\n " ,
127128 }, {
128- err : Wrap (x , "message" ),
129- want : "github.com/pkg/errors/errors_test.go:128: message\n github.com/pkg/errors/errors_test.go:106: error\n " ,
129+ err : Wrap (x , "message" ),
130+ want : "github.com/pkg/errors/errors_test.go:106: error\n " +
131+ "github.com/pkg/errors/errors_test.go:129: message\n " ,
132+ }, {
133+ err : Wrap (io .EOF , "message" ),
134+ want : "EOF\n " +
135+ "github.com/pkg/errors/errors_test.go:133: message\n " ,
130136 }, {
131- err : Wrap (Wrap (x , "message" ), "another message" ),
132- want : "github.com/pkg/errors/errors_test.go:131: another message\n github.com/pkg/errors/errors_test.go:131: message\n github.com/pkg/errors/errors_test.go:106: error\n " ,
137+ err : Wrap (Wrap (x , "message" ), "another message" ),
138+ want : "github.com/pkg/errors/errors_test.go:106: error\n " +
139+ "github.com/pkg/errors/errors_test.go:137: message\n " +
140+ "github.com/pkg/errors/errors_test.go:137: another message\n " ,
133141 }, {
134- err : Wrapf (x , "message" ),
135- want : "github.com/pkg/errors/errors_test.go:134: message\n github.com/pkg/errors/errors_test.go:106: error\n " ,
142+ err : Wrapf (x , "message" ),
143+ want : "github.com/pkg/errors/errors_test.go:106: error\n " +
144+ "github.com/pkg/errors/errors_test.go:142: message\n " ,
136145 }}
137146
138147 for i , tt := range tests {
@@ -198,30 +207,30 @@ func TestStack(t *testing.T) {
198207 want []fileline
199208 }{{
200209 New ("ooh" ), []fileline {
201- {"github.com/pkg/errors/errors_test.go" , 200 },
210+ {"github.com/pkg/errors/errors_test.go" , 209 },
202211 },
203212 }, {
204213 Wrap (New ("ooh" ), "ahh" ), []fileline {
205- {"github.com/pkg/errors/errors_test.go" , 204 }, // this is the stack of Wrap, not New
214+ {"github.com/pkg/errors/errors_test.go" , 213 }, // this is the stack of Wrap, not New
206215 },
207216 }, {
208217 Cause (Wrap (New ("ooh" ), "ahh" )), []fileline {
209- {"github.com/pkg/errors/errors_test.go" , 208 }, // this is the stack of New
218+ {"github.com/pkg/errors/errors_test.go" , 217 }, // this is the stack of New
210219 },
211220 }, {
212221 func () error { return New ("ooh" ) }(), []fileline {
213- {"github.com/pkg/errors/errors_test.go" , 212 }, // this is the stack of New
214- {"github.com/pkg/errors/errors_test.go" , 212 }, // this is the stack of New's caller
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
215224 },
216225 }, {
217226 Cause (func () error {
218227 return func () error {
219228 return Errorf ("hello %s" , fmt .Sprintf ("world" ))
220229 }()
221230 }()), []fileline {
222- {"github.com/pkg/errors/errors_test.go" , 219 }, // this is the stack of Errorf
223- {"github.com/pkg/errors/errors_test.go" , 220 }, // this is the stack of Errorf's caller
224- {"github.com/pkg/errors/errors_test.go" , 221 }, // this is the stack of Errorf's caller's caller
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
225234 },
226235 }}
227236 for _ , tt := range tests {
0 commit comments