MCPcopy
hub / github.com/google/uuid / TestNullUUIDUnmarshalJSON

Function TestNullUUIDUnmarshalJSON

null_test.go:201–214  ·  null_test.go::TestNullUUIDUnmarshalJSON
(t *testing.T)

Source from the content-addressed store, hash-verified

199}
200
201func TestNullUUIDUnmarshalJSON(t *testing.T) {
202 jsonNull, _ := json.Marshal(nil)
203 jsonUUID, _ := json.Marshal(MustParse("12345678-abcd-1234-abcd-0123456789ab"))
204
205 var nu NullUUID
206 err := json.Unmarshal(jsonNull, &nu)
207 if err != nil || nu.Valid {
208 t.Errorf("expected nil when unmarshalling null, got %s", err)
209 }
210 err = json.Unmarshal(jsonUUID, &nu)
211 if err != nil || !nu.Valid {
212 t.Errorf("expected nil when unmarshalling null, got %s", err)
213 }
214}

Callers

nothing calls this directly

Calls 1

MustParseFunction · 0.85

Tested by

no test coverage detected