From 6edd1ae5626190702182aa345a5d97be211cc8f6 Mon Sep 17 00:00:00 2001 From: nhatthm Date: Wed, 9 Aug 2023 15:09:40 +0200 Subject: [PATCH] Fix unit tests --- logger_test.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/logger_test.go b/logger_test.go index 77d7b0e..0db3224 100644 --- a/logger_test.go +++ b/logger_test.go @@ -119,7 +119,7 @@ func TestLogger_Importantw_dev(t *testing.T) { c.Info(ctx, "hello!", "foo", 1) c.Important(ctx, "account created", "foo", 1) - assert.Equal(t, "\tINFO\tzapctxd/logger_test.go:121\taccount created\t{\"foo\": 1}\n", w.String()) + assert.Equal(t, "\tINFO\tzapctxd/logger_test.go:120\taccount created\t{\"foo\": 1}\n", w.String()) } func TestLogger_ColoredOutput_dev(t *testing.T) { @@ -138,7 +138,7 @@ func TestLogger_ColoredOutput_dev(t *testing.T) { c.Info(ctx, "hello!", "foo", 1) c.Important(ctx, "account created", "foo", 1) - assert.Equal(t, "\t\u001B[34mINFO\u001B[0m\tzapctxd/logger_test.go:140\taccount created\t{\"foo\": 1}\n", w.String()) + assert.Equal(t, "\t\u001B[34mINFO\u001B[0m\tzapctxd/logger_test.go:139\taccount created\t{\"foo\": 1}\n", w.String()) } func TestNew_atomic_dev(t *testing.T) { @@ -163,20 +163,20 @@ func TestNew_atomic_dev(t *testing.T) { c.Important(ctx, "msg", "lvl", lvl, "important", true) } - assert.Equal(t, ` ERROR zapctxd/logger_test.go:163 msg {"lvl": "error"} - INFO zapctxd/logger_test.go:164 msg {"lvl": "error", "important": true} - WARN zapctxd/logger_test.go:162 msg {"lvl": "warn"} - ERROR zapctxd/logger_test.go:163 msg {"lvl": "warn"} - INFO zapctxd/logger_test.go:164 msg {"lvl": "warn", "important": true} - INFO zapctxd/logger_test.go:161 msg {"lvl": "info"} - WARN zapctxd/logger_test.go:162 msg {"lvl": "info"} - ERROR zapctxd/logger_test.go:163 msg {"lvl": "info"} - INFO zapctxd/logger_test.go:164 msg {"lvl": "info", "important": true} - DEBUG zapctxd/logger_test.go:160 msg {"lvl": "debug"} - INFO zapctxd/logger_test.go:161 msg {"lvl": "debug"} - WARN zapctxd/logger_test.go:162 msg {"lvl": "debug"} - ERROR zapctxd/logger_test.go:163 msg {"lvl": "debug"} - INFO zapctxd/logger_test.go:164 msg {"lvl": "debug", "important": true} + assert.Equal(t, ` ERROR zapctxd/logger_test.go:162 msg {"lvl": "error"} + INFO zapctxd/logger_test.go:163 msg {"lvl": "error", "important": true} + WARN zapctxd/logger_test.go:161 msg {"lvl": "warn"} + ERROR zapctxd/logger_test.go:162 msg {"lvl": "warn"} + INFO zapctxd/logger_test.go:163 msg {"lvl": "warn", "important": true} + INFO zapctxd/logger_test.go:160 msg {"lvl": "info"} + WARN zapctxd/logger_test.go:161 msg {"lvl": "info"} + ERROR zapctxd/logger_test.go:162 msg {"lvl": "info"} + INFO zapctxd/logger_test.go:163 msg {"lvl": "info", "important": true} + DEBUG zapctxd/logger_test.go:159 msg {"lvl": "debug"} + INFO zapctxd/logger_test.go:160 msg {"lvl": "debug"} + WARN zapctxd/logger_test.go:161 msg {"lvl": "debug"} + ERROR zapctxd/logger_test.go:162 msg {"lvl": "debug"} + INFO zapctxd/logger_test.go:163 msg {"lvl": "debug", "important": true} `, w.String(), w.String()) } @@ -249,9 +249,9 @@ func TestLogger_SkipCaller(t *testing.T) { do() - assert.Equal(t, ` INFO zapctxd/logger_test.go:246 hello {"k": "v"} - INFO zapctxd/logger_test.go:251 world {"k": "v"} - INFO zapctxd/logger_test.go:248 hello {"k": "v"} + assert.Equal(t, ` INFO zapctxd/logger_test.go:245 hello {"k": "v"} + INFO zapctxd/logger_test.go:250 world {"k": "v"} + INFO zapctxd/logger_test.go:247 hello {"k": "v"} `, w.String()) assert.NotNil(t, zapctxd.New(zapctxd.Config{}).SkipCaller())