From beb1103e20568987869043ea56a69ace4b22eae8 Mon Sep 17 00:00:00 2001 From: qydysky Date: Tue, 26 Mar 2024 01:19:15 +0800 Subject: [PATCH] 1 --- errors/errors.go | 2 +- errors/errors_test.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/errors/errors.go b/errors/errors.go index 5e4330e..a5b0e90 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -97,7 +97,7 @@ func ErrorFormat(e error, format ...func(error) string) (s string) { if len(format) > 0 { s += format[0](v) } else { - s += e.Error() + "\n" + s += v.Error() + "\n" } } } else if len(format) > 0 { diff --git a/errors/errors_test.go b/errors/errors_test.go index 83c7a47..8abffca 100644 --- a/errors/errors_test.go +++ b/errors/errors_test.go @@ -32,12 +32,13 @@ func TestXxx(t *testing.T) { func Test2(t *testing.T) { e := Join(New("r0", "a0"), New("r1", "a1")) + t.Log(ErrorFormat(e)) t.Log(ErrorFormat(e, ErrSimplifyFunc)) t.Log(ErrorFormat(e, ErrInLineFunc)) - if ErrorFormat(e, ErrSimplifyFunc) != "r0\nr1\n" { + if ErrorFormat(e, ErrSimplifyFunc) != "a0\na1\n" { t.FailNow() } - if ErrorFormat(e, ErrInLineFunc) != " > r0 > r1" { + if ErrorFormat(e, ErrInLineFunc) != " > a0 > a1" { t.FailNow() } } -- 2.39.2