(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func 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 | |
| 113 | type WrappedTimestamp struct { |
| 114 | A int `json:"A"` |
nothing calls this directly
no test coverage detected
searching dependent graphs…