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

Function TestMarshalTextNil

proto/text_test.go:420–432  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

418 }
419}
420func TestMarshalTextNil(t *testing.T) {
421 want := "<nil>"
422 tests := []proto.Message{nil, (*pb2.MyMessage)(nil)}
423 for i, test := range tests {
424 buf := new(bytes.Buffer)
425 if err := proto.MarshalText(buf, test); err != nil {
426 t.Fatal(err)
427 }
428 if got := buf.String(); got != want {
429 t.Errorf("%d: got %q want %q", i, got, want)
430 }
431 }
432}
433
434func TestMarshalTextUnknownEnum(t *testing.T) {
435 // The Color enum only specifies values 0-2.

Callers

nothing calls this directly

Calls 2

MarshalTextFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected