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

Function TestNidOptStructJSON

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

Source from the content-addressed store, hash-verified

7084 }
7085}
7086func TestNidOptStructJSON(t *testing.T) {
7087 seed := time.Now().UnixNano()
7088 popr := math_rand.New(math_rand.NewSource(seed))
7089 p := NewPopulatedNidOptStruct(popr, true)
7090 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
7091 jsondata, err := marshaler.MarshalToString(p)
7092 if err != nil {
7093 t.Fatalf("seed = %d, err = %v", seed, err)
7094 }
7095 msg := &NidOptStruct{}
7096 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
7097 if err != nil {
7098 t.Fatalf("seed = %d, err = %v", seed, err)
7099 }
7100 if err := p.VerboseEqual(msg); err != nil {
7101 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
7102 }
7103 if !p.Equal(msg) {
7104 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
7105 }
7106}
7107func TestNinOptStructJSON(t *testing.T) {
7108 seed := time.Now().UnixNano()
7109 popr := math_rand.New(math_rand.NewSource(seed))

Callers

nothing calls this directly

Calls 4

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