MCPcopy
hub / github.com/golang/protobuf / init

Function init

proto/proto_clone_test.go:36–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34}
35
36func init() {
37 ext := &pb2.Ext{
38 Data: proto.String("extension"),
39 }
40 if err := proto.SetExtension(cloneTestMessage, pb2.E_Ext_More, ext); err != nil {
41 panic("SetExtension: " + err.Error())
42 }
43 if err := proto.SetExtension(cloneTestMessage, pb2.E_Ext_Text, proto.String("hello")); err != nil {
44 panic("SetExtension: " + err.Error())
45 }
46 if err := proto.SetExtension(cloneTestMessage, pb2.E_Greeting, []string{"one", "two"}); err != nil {
47 panic("SetExtension: " + err.Error())
48 }
49}
50
51func TestClone(t *testing.T) {
52 // Create a clone using a marshal/unmarshal roundtrip.

Callers

nothing calls this directly

Calls 3

StringFunction · 0.92
SetExtensionFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected