From 6fe7e03b80e1185ccf2e16c53420a1f2b9171ebd Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 16 Jul 2023 21:17:05 +0200 Subject: [PATCH] log: remove testify dependency Testify was only used for a basic assertion. Remove the dependency, in preparation of (potentially) moving this package to a separate module. Signed-off-by: Sebastiaan van Stijn --- log/context_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/log/context_test.go b/log/context_test.go index 718302c6f..c641aea65 100644 --- a/log/context_test.go +++ b/log/context_test.go @@ -18,15 +18,20 @@ package log import ( "context" + "reflect" "testing" - - "github.com/stretchr/testify/assert" ) func TestLoggerContext(t *testing.T) { + const expected = "one" ctx := context.Background() - - ctx = WithLogger(ctx, G(ctx).WithField("test", "one")) - assert.Equal(t, GetLogger(ctx).Data["test"], "one") - assert.Same(t, G(ctx), GetLogger(ctx)) // these should be the same. + ctx = WithLogger(ctx, G(ctx).WithField("test", expected)) + if actual := GetLogger(ctx).Data["test"]; actual != expected { + t.Errorf("expected: %v, got: %v", expected, actual) + } + a := G(ctx) + b := GetLogger(ctx) + if !reflect.DeepEqual(a, b) || a != b { + t.Errorf("should be the same: %+v, %+v", a, b) + } }