Skip to content

Commit

Permalink
chore: add more tests (zeromicro#2129)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan authored Jul 11, 2022
1 parent d71b3c8 commit 23f3423
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/errorx/wrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit 23f3423

Please sign in to comment.