MCPcopy
hub / github.com/protocolbuffers/protobuf-go / TestDecodeFastCheckInitialized

Function TestDecodeFastCheckInitialized

proto/methods_test.go:135–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

133}
134
135func TestDecodeFastCheckInitialized(t *testing.T) {
136 for _, test := range testValidMessages {
137 if !test.checkFastInit {
138 continue
139 }
140 for _, message := range test.decodeTo {
141 t.Run(fmt.Sprintf("%s (%T)", test.desc, message), func(t *testing.T) {
142 m := message.ProtoReflect().New()
143 opts := proto.UnmarshalOptions{
144 AllowPartial: true,
145 }
146 out, err := opts.UnmarshalState(protoiface.UnmarshalInput{
147 Buf: test.wire,
148 Message: m,
149 })
150 if err != nil {
151 t.Fatalf("Unmarshal error: %v", err)
152 }
153 if got, want := (out.Flags&protoiface.UnmarshalInitialized != 0), !test.partial; got != want {
154 t.Errorf("out.Initialized = %v, want %v", got, want)
155 }
156 })
157 }
158 }
159}
160
161type selfMerger struct {
162 src protoiface.MessageV1

Callers

nothing calls this directly

Calls 4

UnmarshalStateMethod · 0.95
RunMethod · 0.80
NewMethod · 0.65
ProtoReflectMethod · 0.65

Tested by

no test coverage detected