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

Function TestNinRepStructJSON

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

Source from the content-addressed store, hash-verified

5243 }
5244}
5245func TestNinRepStructJSON(t *testing.T) {
5246 seed := time.Now().UnixNano()
5247 popr := math_rand.New(math_rand.NewSource(seed))
5248 p := NewPopulatedNinRepStruct(popr, true)
5249 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
5250 jsondata, err := marshaler.MarshalToString(p)
5251 if err != nil {
5252 t.Fatalf("seed = %d, err = %v", seed, err)
5253 }
5254 msg := &NinRepStruct{}
5255 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
5256 if err != nil {
5257 t.Fatalf("seed = %d, err = %v", seed, err)
5258 }
5259 if err := p.VerboseEqual(msg); err != nil {
5260 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
5261 }
5262 if !p.Equal(msg) {
5263 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
5264 }
5265}
5266func TestNidEmbeddedStructJSON(t *testing.T) {
5267 seed := time.Now().UnixNano()
5268 popr := math_rand.New(math_rand.NewSource(seed))

Callers

nothing calls this directly

Calls 4

MarshalToStringMethod · 0.95
NewPopulatedNinRepStructFunction · 0.70
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…