Do we catch the "required bit not set" case?
(t *testing.T)
| 353 | |
| 354 | // Do we catch the "required bit not set" case? |
| 355 | func TestRequiredBit(t *testing.T) { |
| 356 | o := new(proto.Buffer) |
| 357 | pb := new(pb2.GoTest) |
| 358 | err := o.Marshal(pb) |
| 359 | if err == nil { |
| 360 | t.Error("did not catch missing required fields") |
| 361 | } else if !strings.Contains(err.Error(), "Kind") { |
| 362 | t.Error("wrong error type:", err) |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | // Check that all fields are nil. |
| 367 | // Clearly silly, and a residue from a more interesting test with an earlier, |