Skip to content

Commit c79614e

Browse files
committed
slog: accept UTC times and Windows drive letters
The regexp that matches the current time in tests now accepts a "Z" timezone designator. Previously it assumed that the timezone was formatted as an offset from UTC. The regexp that matched a source pathname now accepts an optional intial drive letter and colon, for Windows compatibility. Change-Id: I17dfae16e08cae0291abe90216ed25c61750dffb Reviewed-on: https://go-review.googlesource.com/c/exp/+/429836 Run-TryBot: Jonathan Amsterdam <[email protected]> Reviewed-by: Alan Donovan <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 3746e55 commit c79614e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

slog/logger_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"time"
1717
)
1818

19-
const timeRE = `\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}-\d{2}:\d{2}`
19+
const timeRE = `\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}(Z|-\d{2}:\d{2})`
2020

2121
func TestLogTextHandler(t *testing.T) {
2222
var buf bytes.Buffer

slog/text_handler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func TestTextHandlerSource(t *testing.T) {
9797
t.Fatal(err)
9898
}
9999
got := buf.String()
100-
wantRE := `source=[^:]+text_handler_test\.go:\d+ msg`
100+
wantRE := `source=([A-Z]:)?[^:]+text_handler_test\.go:\d+ msg`
101101
matched, err := regexp.MatchString(wantRE, got)
102102
if err != nil {
103103
t.Fatal(err)

0 commit comments

Comments
 (0)