]> Cypherpunks repositories - gostls13.git/commitdiff
log/slog: add missing test in value_test.go
authorpgxiaolianzi <gnnu_d13@163.com>
Tue, 30 Jan 2024 16:05:21 +0000 (16:05 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 30 Jan 2024 20:10:22 +0000 (20:10 +0000)
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 <jba@google.com>
Auto-Submit: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/log/slog/value_test.go

index 923a4e0cccfb430b1ff03cb911c76be210120b83..df83da4d6925efd2754c3e0903b0b532b25a0a2f 100644 (file)
@@ -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()