From: pgxiaolianzi Date: Tue, 30 Jan 2024 16:05:21 +0000 (+0000) Subject: log/slog: add missing test in value_test.go X-Git-Tag: go1.23rc1~1342 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=702d609a31f02007b471c072b633fa4238554022;p=gostls13.git log/slog: add missing test in value_test.go TestValueEqual: Added test cases for DurationValue, StringValue, and TimeValue types. TestValueAny: Added a test case for string values. Change-Id: I74ef15bcfcacd0bf5d990debd24846283edf1ecd GitHub-Last-Rev: 6adb9f6f3147f0c655789b3bc86336a5c89a1b44 GitHub-Pull-Request: golang/go#65303 Reviewed-on: https://go-review.googlesource.com/c/go/+/558755 Reviewed-by: Jonathan Amsterdam Auto-Submit: Jonathan Amsterdam Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI --- diff --git a/src/log/slog/value_test.go b/src/log/slog/value_test.go index 923a4e0ccc..df83da4d69 100644 --- a/src/log/slog/value_test.go +++ b/src/log/slog/value_test.go @@ -30,9 +30,16 @@ func TestValueEqual(t *testing.T) { BoolValue(true), BoolValue(false), TimeValue(testTime), + TimeValue(time.Date(2001, 1, 2, 3, 4, 5, 0, time.UTC)), AnyValue(&x), AnyValue(&y), GroupValue(Bool("b", true), Int("i", 3)), + GroupValue(Bool("b", true), Int("i", 4)), + GroupValue(Bool("b", true), Int("j", 4)), + DurationValue(3 * time.Second), + DurationValue(2 * time.Second), + StringValue("foo"), + StringValue("fuu"), } for i, v1 := range vals { for j, v2 := range vals { @@ -164,6 +171,7 @@ func TestValueAny(t *testing.T) { time.Minute, time.Time{}, 3.14, + "foo", } { v := AnyValue(want) got := v.Any()