MCPcopy Index your code
hub / github.com/google/go-github / TestTimestamp_MarshalReflexivity

Function TestTimestamp_MarshalReflexivity

github/timestamp_test.go:88–111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func TestTimestamp_MarshalReflexivity(t *testing.T) {
89 t.Parallel()
90 testCases := []struct {
91 desc string
92 data Timestamp
93 }{
94 {"Reference", Timestamp{referenceTime}},
95 {"Empty", Timestamp{}},
96 }
97 for _, tc := range testCases {
98 data, err := json.Marshal(tc.data)
99 if err != nil {
100 t.Errorf("%v: Marshal err=%v", tc.desc, err)
101 }
102 var got Timestamp
103 err = json.Unmarshal(data, &got)
104 if err != nil {
105 t.Errorf("%v: Unmarshal err=%v", tc.desc, err)
106 }
107 if !got.Equal(tc.data) {
108 t.Errorf("%v: %+v != %+v", tc.desc, got, data)
109 }
110 }
111}
112
113type WrappedTimestamp struct {
114 A int `json:"A"`

Callers

nothing calls this directly

Calls 1

EqualMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…