MCPcopy Create free account
hub / github.com/google/uuid / TestJSON

Function TestJSON

json_test.go:15–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13var testUUID = MustParse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
14
15func TestJSON(t *testing.T) {
16 type S struct {
17 ID1 UUID
18 ID2 UUID
19 }
20 s1 := S{ID1: testUUID}
21 data, err := json.Marshal(&s1)
22 if err != nil {
23 t.Fatal(err)
24 }
25 var s2 S
26 if err := json.Unmarshal(data, &s2); err != nil {
27 t.Fatal(err)
28 }
29 if !reflect.DeepEqual(&s1, &s2) {
30 t.Errorf("got %#v, want %#v", s2, s1)
31 }
32}
33
34func TestJSONUnmarshal(t *testing.T) {
35 type S struct {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected