(t *testing.T)
| 2180 | } |
| 2181 | |
| 2182 | func TestRequired(t *testing.T) { |
| 2183 | // The F_BoolRequired field appears after all of the required fields. |
| 2184 | // It should still be handled even after multiple required field violations. |
| 2185 | m := &pb2.GoTest{F_BoolRequired: proto.Bool(true)} |
| 2186 | got, err := proto.Marshal(m) |
| 2187 | if !isRequiredNotSetError(err) { |
| 2188 | t.Errorf("Marshal() = %v, want RequiredNotSetError error", err) |
| 2189 | } |
| 2190 | if want := []byte{0x50, 0x01}; !bytes.Equal(got, want) { |
| 2191 | t.Errorf("Marshal() = %x, want %x", got, want) |
| 2192 | } |
| 2193 | |
| 2194 | m = new(pb2.GoTest) |
| 2195 | err = proto.Unmarshal(got, m) |
| 2196 | if !isRequiredNotSetError(err) { |
| 2197 | t.Errorf("Marshal() = %v, want RequiredNotSetError error", err) |
| 2198 | } |
| 2199 | if !m.GetF_BoolRequired() { |
| 2200 | t.Error("m.F_BoolRequired = false, want true") |
| 2201 | } |
| 2202 | } |
| 2203 | |
| 2204 | func TestUnknownV2(t *testing.T) { |
| 2205 | m := new(tspb.Timestamp) |
nothing calls this directly
no test coverage detected