From a9f9a4c0718e2579d7dc20c16a6609c34c0edd62 Mon Sep 17 00:00:00 2001 From: Noah Stride Date: Mon, 27 Jun 2022 10:18:08 +0100 Subject: [PATCH] switch to testify/require --- trace_test.go | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/trace_test.go b/trace_test.go index fae74ba..c0944fc 100644 --- a/trace_test.go +++ b/trace_test.go @@ -28,6 +28,7 @@ import ( "testing" log "github.com/sirupsen/logrus" + "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" ) @@ -713,25 +714,11 @@ func TestStdlibCompat_Aggregate(t *testing.T) { agg := Wrap(NewAggregate(Wrap(badParamErr), fooErr)) - if !errors.Is(agg, badParamErr) { - t.Error("trace.Is(agg, badParamErr): got false, want true") - } - if !errors.Is(agg, fooErr) { - t.Error("trace.Is(agg, fooErr): got false, want true") - } - if errors.Is(agg, randomErr) { - t.Error("trace.Is(agg, randomErr): got true, want false") - } + require.ErrorIs(t, agg, badParamErr) + require.ErrorIs(t, agg, fooErr) + require.NotErrorIs(t, agg, randomErr) var badParamErrTarget *BadParameterError - if !errors.As(agg, &badParamErrTarget) { - t.Error("trace.As(agg, badParamErrTarget): got true, want false") - } else { - if badParamErrTarget.Message != bpMsg { - t.Errorf( - "badParamErrTarget: got '%s', want '%s'", - badParamErrTarget.Message, bpMsg, - ) - } - } + require.ErrorAs(t, agg, &badParamErrTarget) + require.Equal(t, bpMsg, badParamErrTarget.Message) }