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

Function TestNinEmbeddedStructJSON

test/thetestpb_test.go:5287–5307  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5285 }
5286}
5287func TestNinEmbeddedStructJSON(t *testing.T) {
5288 seed := time.Now().UnixNano()
5289 popr := math_rand.New(math_rand.NewSource(seed))
5290 p := NewPopulatedNinEmbeddedStruct(popr, true)
5291 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
5292 jsondata, err := marshaler.MarshalToString(p)
5293 if err != nil {
5294 t.Fatalf("seed = %d, err = %v", seed, err)
5295 }
5296 msg := &NinEmbeddedStruct{}
5297 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
5298 if err != nil {
5299 t.Fatalf("seed = %d, err = %v", seed, err)
5300 }
5301 if err := p.VerboseEqual(msg); err != nil {
5302 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
5303 }
5304 if !p.Equal(msg) {
5305 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
5306 }
5307}
5308func TestNidNestedStructJSON(t *testing.T) {
5309 seed := time.Now().UnixNano()
5310 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…