Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 2d32025

Browse files
author
Ivan Mirić
committed
Add a mixed value ConsoleLogFormatter test case
1 parent 3c09824 commit 2d32025

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

common/logger_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,23 @@ func TestConsoleLogFormatter(t *testing.T) {
5252
expected: `{"one":1,"two":"two"} {"nested":{"sub":7.777}}`,
5353
},
5454
{
55+
// The first object can't be serialized to JSON, so it will be
56+
// skipped in the output.
5557
objects: []interface{}{
5658
map[string]interface{}{"one": 1, "fail": make(chan int)},
5759
map[string]interface{}{"two": 2},
5860
},
5961
expected: `{"two":2}`,
6062
},
63+
{
64+
// Mixed objects and primitive values
65+
objects: []interface{}{
66+
map[string]interface{}{"one": 1},
67+
"someString",
68+
42,
69+
},
70+
expected: `{"one":1} "someString" 42`,
71+
},
6172
}
6273

6374
fmtr := &consoleLogFormatter{&testLogFormatter{}}

0 commit comments

Comments
 (0)