(t *testing.T, pb *pb2.GoTest, want []byte)
| 98 | } |
| 99 | |
| 100 | func overify(t *testing.T, pb *pb2.GoTest, want []byte) { |
| 101 | bb := new(proto.Buffer) |
| 102 | err := bb.Marshal(pb) |
| 103 | got := bb.Bytes() |
| 104 | if err != nil { |
| 105 | t.Logf("overify marshal-1 err = %v", err) |
| 106 | } |
| 107 | if !bytes.Equal(got, want) { |
| 108 | t.Fatalf("got %q\nwant %q", got, want) |
| 109 | } |
| 110 | |
| 111 | // Now test Unmarshal by recreating the original buffer. |
| 112 | pbd := new(pb2.GoTest) |
| 113 | err = bb.Unmarshal(pbd) |
| 114 | if err != nil { |
| 115 | t.Fatalf("overify unmarshal err = %v", err) |
| 116 | } |
| 117 | bb.Reset() |
| 118 | err = bb.Marshal(pbd) |
| 119 | got = bb.Bytes() |
| 120 | if err != nil { |
| 121 | t.Fatalf("overify marshal-2 err = %v", err) |
| 122 | } |
| 123 | if !bytes.Equal(got, want) { |
| 124 | t.Fatalf("got %q\nwant %q", got, want) |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | // When hooks are enabled, RequiredNotSetError is typed alias to internal/proto |
| 129 | // package. Binary serialization has not been wrapped yet and hence produces |
no test coverage detected