diff options
Diffstat (limited to 'tests/gobang.go')
-rw-r--r-- | tests/gobang.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/gobang.go b/tests/gobang.go index 842b95a..ef07271 100644 --- a/tests/gobang.go +++ b/tests/gobang.go @@ -1042,6 +1042,26 @@ func test_setLoggerOutput() { ErrorIf(err) }) + Testing("we can add groups to the default logger", func() { + s := new(strings.Builder) + setLoggerOutput(s, slog.Group("one", "key", "value")) + Info("", "") + + var data map[string]interface{} + err := json.Unmarshal([]byte(s.String()), &data) + ErrorIf(err) + + oneRaw, ok := data["one"] + AssertEqual(ok, true) + one, ok := oneRaw.(map[string]interface{}) + AssertEqual(ok, true) + + keyRaw, ok := one["key"] + AssertEqual(ok, true) + key, ok := keyRaw.(string) + AssertEqual(key, "value") + }) + Testing("the puuid is the same across calls to the logger", func() { s := new(strings.Builder) setLoggerOutput(s) |