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

Function TestMarshalText

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

Source from the content-addressed store, hash-verified

397`
398
399func TestMarshalText(t *testing.T) {
400 buf := new(bytes.Buffer)
401 if err := proto.MarshalText(buf, newTestMessage()); err != nil {
402 t.Fatalf("proto.MarshalText: %v", err)
403 }
404 got := buf.String()
405 if diff := cmp.Diff(text, got); got != text {
406 t.Errorf("diff (-want +got):\n%v\n\ngot:\n%v\n\nwant:\n%v", diff, got, text)
407 }
408}
409
410func TestMarshalTextCustomMessage(t *testing.T) {
411 buf := new(bytes.Buffer)

Callers

nothing calls this directly

Calls 3

MarshalTextFunction · 0.92
newTestMessageFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected