From 23f34234d0c2e9471bac6420fe9e71462f0b4d55 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Mon, 11 Jul 2022 23:32:57 +0800 Subject: [PATCH] chore: add more tests (#2129) --- core/errorx/wrap_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/errorx/wrap_test.go b/core/errorx/wrap_test.go index 088bc378..4682c9e7 100644 --- a/core/errorx/wrap_test.go +++ b/core/errorx/wrap_test.go @@ -10,9 +10,15 @@ import ( func TestWrap(t *testing.T) { assert.Nil(t, Wrap(nil, "test")) assert.Equal(t, "foo: bar", Wrap(errors.New("bar"), "foo").Error()) + + err := errors.New("foo") + assert.True(t, errors.Is(Wrap(err, "bar"), err)) } func TestWrapf(t *testing.T) { assert.Nil(t, Wrapf(nil, "%s", "test")) assert.Equal(t, "foo bar: quz", Wrapf(errors.New("quz"), "foo %s", "bar").Error()) + + err := errors.New("foo") + assert.True(t, errors.Is(Wrapf(err, "foo %s", "bar"), err)) }