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 <github@gone.nl>
This commit is contained in:
parent
e2ad5a985e
commit
6fe7e03b80
@ -18,15 +18,20 @@ package log
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLoggerContext(t *testing.T) {
|
func TestLoggerContext(t *testing.T) {
|
||||||
|
const expected = "one"
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
ctx = WithLogger(ctx, G(ctx).WithField("test", expected))
|
||||||
ctx = WithLogger(ctx, G(ctx).WithField("test", "one"))
|
if actual := GetLogger(ctx).Data["test"]; actual != expected {
|
||||||
assert.Equal(t, GetLogger(ctx).Data["test"], "one")
|
t.Errorf("expected: %v, got: %v", expected, actual)
|
||||||
assert.Same(t, G(ctx), GetLogger(ctx)) // these should be the same.
|
}
|
||||||
|
a := G(ctx)
|
||||||
|
b := GetLogger(ctx)
|
||||||
|
if !reflect.DeepEqual(a, b) || a != b {
|
||||||
|
t.Errorf("should be the same: %+v, %+v", a, b)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user