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

Function TestMarshalTextCustomMessage

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

Source from the content-addressed store, hash-verified

408}
409
410func TestMarshalTextCustomMessage(t *testing.T) {
411 buf := new(bytes.Buffer)
412 if err := proto.MarshalText(buf, &textMessage{}); err != nil {
413 t.Fatalf("proto.MarshalText: %v", err)
414 }
415 got := buf.String()
416 if got != "custom" {
417 t.Errorf("got:\n%v\n\nwant:\n%v", got, "custom")
418 }
419}
420func TestMarshalTextNil(t *testing.T) {
421 want := "<nil>"
422 tests := []proto.Message{nil, (*pb2.MyMessage)(nil)}

Callers

nothing calls this directly

Calls 2

MarshalTextFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected