]> Cypherpunks.ru repositories - gostls13.git/commitdiff
log/slog: fix faulty test
authorMerrick Clay <merrick.e.clay@gmail.com>
Wed, 5 Jul 2023 21:06:39 +0000 (15:06 -0600)
committerJonathan Amsterdam <jba@google.com>
Thu, 6 Jul 2023 00:01:44 +0000 (00:01 +0000)
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>

src/log/slog/logger_test.go

index d151c0490cdce5d474675a420006e2769d8468d2..130f2e6ac8a5300f09486afa0bc43e457f0c1885 100644 (file)
@@ -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()