|
|
@@ -27,12 +27,11 @@ func TestFormatNew(t *testing.T) {
|
|
|
"%+v",
|
|
|
"error\n" +
|
|
|
"github.com/pkg/errors.TestFormatNew\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:25",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:26",
|
|
|
}, {
|
|
|
New("error"),
|
|
|
"%q",
|
|
|
`"error"`,
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:26",
|
|
|
}}
|
|
|
|
|
|
for i, tt := range tests {
|
|
|
@@ -58,7 +57,7 @@ func TestFormatErrorf(t *testing.T) {
|
|
|
"%+v",
|
|
|
"error\n" +
|
|
|
"github.com/pkg/errors.TestFormatErrorf\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:55",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:56",
|
|
|
}}
|
|
|
|
|
|
for i, tt := range tests {
|
|
|
@@ -84,7 +83,7 @@ func TestFormatWrap(t *testing.T) {
|
|
|
"%+v",
|
|
|
"error\n" +
|
|
|
"github.com/pkg/errors.TestFormatWrap\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:81",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:82",
|
|
|
}, {
|
|
|
Wrap(io.EOF, "error"),
|
|
|
"%s",
|
|
|
@@ -99,14 +98,14 @@ func TestFormatWrap(t *testing.T) {
|
|
|
"EOF\n" +
|
|
|
"error\n" +
|
|
|
"github.com/pkg/errors.TestFormatWrap\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:95",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:96",
|
|
|
}, {
|
|
|
Wrap(Wrap(io.EOF, "error1"), "error2"),
|
|
|
"%+v",
|
|
|
"EOF\n" +
|
|
|
"error1\n" +
|
|
|
"github.com/pkg/errors.TestFormatWrap\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:102\n",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:103\n",
|
|
|
}, {
|
|
|
Wrap(New("error with space"), "context"),
|
|
|
"%q",
|
|
|
@@ -137,7 +136,7 @@ func TestFormatWrapf(t *testing.T) {
|
|
|
"EOF\n" +
|
|
|
"error2\n" +
|
|
|
"github.com/pkg/errors.TestFormatWrapf\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:133",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:134",
|
|
|
}, {
|
|
|
Wrapf(New("error"), "error%d", 2),
|
|
|
"%s",
|
|
|
@@ -151,7 +150,7 @@ func TestFormatWrapf(t *testing.T) {
|
|
|
"%+v",
|
|
|
"error\n" +
|
|
|
"github.com/pkg/errors.TestFormatWrapf\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:148",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:149",
|
|
|
}}
|
|
|
|
|
|
for i, tt := range tests {
|
|
|
@@ -177,7 +176,7 @@ func TestFormatWithStack(t *testing.T) {
|
|
|
"%+v",
|
|
|
[]string{"EOF",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:171"},
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:175"},
|
|
|
}, {
|
|
|
WithStack(New("error")),
|
|
|
"%s",
|
|
|
@@ -191,36 +190,36 @@ func TestFormatWithStack(t *testing.T) {
|
|
|
"%+v",
|
|
|
[]string{"error",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:185",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:189",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:185"},
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:189"},
|
|
|
}, {
|
|
|
WithStack(WithStack(io.EOF)),
|
|
|
"%+v",
|
|
|
[]string{"EOF",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:193",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:197",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:193"},
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:197"},
|
|
|
}, {
|
|
|
WithStack(WithStack(Wrapf(io.EOF, "message"))),
|
|
|
"%+v",
|
|
|
[]string{"EOF",
|
|
|
"message",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:201",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:205",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:201",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:205",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:201"},
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:205"},
|
|
|
}, {
|
|
|
WithStack(Errorf("error%d", 1)),
|
|
|
"%+v",
|
|
|
[]string{"error1",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:212",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:216",
|
|
|
"github.com/pkg/errors.TestFormatWithStack\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:212"},
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:216"},
|
|
|
}}
|
|
|
|
|
|
for i, tt := range tests {
|
|
|
@@ -247,7 +246,7 @@ func TestFormatWithMessage(t *testing.T) {
|
|
|
[]string{
|
|
|
"error",
|
|
|
"github.com/pkg/errors.TestFormatWithMessage\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:240",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:244",
|
|
|
"error2"},
|
|
|
}, {
|
|
|
WithMessage(io.EOF, "addition1"),
|
|
|
@@ -274,13 +273,13 @@ func TestFormatWithMessage(t *testing.T) {
|
|
|
"%+v",
|
|
|
[]string{"EOF", "error1", "error2",
|
|
|
"github.com/pkg/errors.TestFormatWithMessage\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:268"},
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:272"},
|
|
|
}, {
|
|
|
WithMessage(Errorf("error%d", 1), "error2"),
|
|
|
"%+v",
|
|
|
[]string{"error1",
|
|
|
"github.com/pkg/errors.TestFormatWithMessage\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:274",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:278",
|
|
|
"error2"},
|
|
|
}, {
|
|
|
WithMessage(WithStack(io.EOF), "error"),
|
|
|
@@ -288,7 +287,7 @@ func TestFormatWithMessage(t *testing.T) {
|
|
|
[]string{
|
|
|
"EOF",
|
|
|
"github.com/pkg/errors.TestFormatWithMessage\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:281",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:285",
|
|
|
"error"},
|
|
|
}, {
|
|
|
WithMessage(Wrap(WithStack(io.EOF), "inside-error"), "outside-error"),
|
|
|
@@ -296,10 +295,10 @@ func TestFormatWithMessage(t *testing.T) {
|
|
|
[]string{
|
|
|
"EOF",
|
|
|
"github.com/pkg/errors.TestFormatWithMessage\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:289",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:293",
|
|
|
"inside-error",
|
|
|
"github.com/pkg/errors.TestFormatWithMessage\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:289",
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:293",
|
|
|
"outside-error"},
|
|
|
}}
|
|
|
|
|
|
@@ -316,11 +315,11 @@ func TestFormatGeneric(t *testing.T) {
|
|
|
{New("new-error"), []string{
|
|
|
"new-error",
|
|
|
"github.com/pkg/errors.TestFormatGeneric\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:311"},
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:315"},
|
|
|
}, {Errorf("errorf-error"), []string{
|
|
|
"errorf-error",
|
|
|
"github.com/pkg/errors.TestFormatGeneric\n" +
|
|
|
- "\t.+/github.com/pkg/errors/format_test.go:315"},
|
|
|
+ "\t.+/github.com/pkg/errors/format_test.go:319"},
|
|
|
}, {errors.New("errors-new-error"), []string{
|
|
|
"errors-new-error"},
|
|
|
},
|
|
|
@@ -334,21 +333,21 @@ func TestFormatGeneric(t *testing.T) {
|
|
|
func(err error) error { return WithStack(err) },
|
|
|
[]string{
|
|
|
"github.com/pkg/errors.(func·002|TestFormatGeneric.func2)\n\t" +
|
|
|
- ".+/github.com/pkg/errors/format_test.go:329",
|
|
|
+ ".+/github.com/pkg/errors/format_test.go:333",
|
|
|
},
|
|
|
}, {
|
|
|
func(err error) error { return Wrap(err, "wrap-error") },
|
|
|
[]string{
|
|
|
"wrap-error",
|
|
|
"github.com/pkg/errors.(func·003|TestFormatGeneric.func3)\n\t" +
|
|
|
- ".+/github.com/pkg/errors/format_test.go:335",
|
|
|
+ ".+/github.com/pkg/errors/format_test.go:339",
|
|
|
},
|
|
|
}, {
|
|
|
func(err error) error { return Wrapf(err, "wrapf-error%d", 1) },
|
|
|
[]string{
|
|
|
"wrapf-error1",
|
|
|
"github.com/pkg/errors.(func·004|TestFormatGeneric.func4)\n\t" +
|
|
|
- ".+/github.com/pkg/errors/format_test.go:342",
|
|
|
+ ".+/github.com/pkg/errors/format_test.go:346",
|
|
|
},
|
|
|
},
|
|
|
}
|