aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerrick Clay <merrick.e.clay@gmail.com>2023-07-05 15:06:39 -0600
committerJonathan Amsterdam <jba@google.com>2023-07-06 00:01:44 +0000
commit36ea4f9680f8296f1c7d0cf7dbb1b3a9d572754a (patch)
tree04bd9d1b867bbf6c6c2de48109c2c0df7c26956a
parent3fce1115359c4ab7d67fbf4efef1341e52b354b7 (diff)
downloadgo-36ea4f9680f8296f1c7d0cf7dbb1b3a9d572754a.tar.gz
go-36ea4f9680f8296f1c7d0cf7dbb1b3a9d572754a.zip
log/slog: fix faulty test
Adds an optional close quote in the expected log message regex for TestConnections to prevent failing when the source filepath is surrounded in quotes due to it containing one or more spaces. Fixes #61161 Change-Id: I0dd71fb4389bff963bbfdc668ef4e4dfe787eafc Reviewed-on: https://go-review.googlesource.com/c/go/+/508055 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r--src/log/slog/logger_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/log/slog/logger_test.go b/src/log/slog/logger_test.go
index d151c0490c..130f2e6ac8 100644
--- a/src/log/slog/logger_test.go
+++ b/src/log/slog/logger_test.go
@@ -106,7 +106,7 @@ func TestConnections(t *testing.T) {
// log.Logger's output goes through the handler.
SetDefault(New(NewTextHandler(&slogbuf, &HandlerOptions{AddSource: true})))
log.Print("msg2")
- checkLogOutput(t, slogbuf.String(), "time="+timeRE+` level=INFO source=.*logger_test.go:\d{3} msg=msg2`)
+ checkLogOutput(t, slogbuf.String(), "time="+timeRE+` level=INFO source=.*logger_test.go:\d{3}"? msg=msg2`)
// The default log.Logger always outputs at Info level.
slogbuf.Reset()