MCPcopy
hub / github.com/gogo/protobuf / TestNinEmbeddedStructJSON

Function TestNinEmbeddedStructJSON

test/combos/both/thetestpb_test.go:7191–7211  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7189 }
7190}
7191func TestNinEmbeddedStructJSON(t *testing.T) {
7192 seed := time.Now().UnixNano()
7193 popr := math_rand.New(math_rand.NewSource(seed))
7194 p := NewPopulatedNinEmbeddedStruct(popr, true)
7195 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
7196 jsondata, err := marshaler.MarshalToString(p)
7197 if err != nil {
7198 t.Fatalf("seed = %d, err = %v", seed, err)
7199 }
7200 msg := &NinEmbeddedStruct{}
7201 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
7202 if err != nil {
7203 t.Fatalf("seed = %d, err = %v", seed, err)
7204 }
7205 if err := p.VerboseEqual(msg); err != nil {
7206 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
7207 }
7208 if !p.Equal(msg) {
7209 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
7210 }
7211}
7212func TestNidNestedStructJSON(t *testing.T) {
7213 seed := time.Now().UnixNano()
7214 popr := math_rand.New(math_rand.NewSource(seed))

Callers

nothing calls this directly

Calls 4

MarshalToStringMethod · 0.95
VerboseEqualMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…