Jonathan Amsterdam submitted this change.
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 <j...@google.com>
Reviewed-by: Alan Donovan <adon...@google.com>
TryBot-Result: Gopher Robot <go...@golang.org>
---
M slog/logger_test.go
M slog/text_handler_test.go
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/slog/logger_test.go b/slog/logger_test.go
index acee8d5..f6fcb16 100644
--- a/slog/logger_test.go
+++ b/slog/logger_test.go
@@ -16,7 +16,7 @@
"time"
)
-const timeRE = `\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}-\d{2}:\d{2}`
+const timeRE = `\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}(Z|-\d{2}:\d{2})`
func TestLogTextHandler(t *testing.T) {
var buf bytes.Buffer
diff --git a/slog/text_handler_test.go b/slog/text_handler_test.go
index a7d2602..4d40742 100644
--- a/slog/text_handler_test.go
+++ b/slog/text_handler_test.go
@@ -97,7 +97,7 @@
t.Fatal(err)
}
got := buf.String()
- wantRE := `source=[^:]+text_handler_test\.go:\d+ msg`
+ wantRE := `source=([A-Z]:)?[^:]+text_handler_test\.go:\d+ msg`
matched, err := regexp.MatchString(wantRE, got)
if err != nil {
t.Fatal(err)
To view, visit change 429836. To unsubscribe, or for help writing mail filters, visit settings.