aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/slogtest/slogtest.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/testing/slogtest/slogtest.go b/src/testing/slogtest/slogtest.go
index e60e8438d4..6f08180df5 100644
--- a/src/testing/slogtest/slogtest.go
+++ b/src/testing/slogtest/slogtest.go
@@ -216,6 +216,17 @@ var cases = []testCase{
inGroup("G", hasAttr("b", "v2")),
},
},
+ {
+ name: "empty-PC",
+ explanation: withSource("a Handler should not output SourceKey if the PC is zero"),
+ f: func(l *slog.Logger) {
+ l.Info("message")
+ },
+ mod: func(r *slog.Record) { r.PC = 0 },
+ checks: []check{
+ missingKey(slog.SourceKey),
+ },
+ },
}
// TestHandler tests a [slog.Handler].