mirror of https://github.com/golang/go.git
testing/slogtest: test no source key with empty PC in record
Fixes #62280 Change-Id: Ideaffb797d8bb9cc70e635f0b019ae3cb90abc92 Reviewed-on: https://go-review.googlesource.com/c/go/+/536117 Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
parent
6f87db509a
commit
983d90e11d
|
|
@ -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].
|
||||
|
|
|
|||
Loading…
Reference in New Issue