(t *testing.T)
| 582 | } |
| 583 | |
| 584 | func TestClearAllExtensions(t *testing.T) { |
| 585 | // unregistered extension |
| 586 | desc := &proto.ExtensionDesc{ |
| 587 | ExtendedType: (*pb2.MyMessage)(nil), |
| 588 | ExtensionType: (*bool)(nil), |
| 589 | Field: 101010100, |
| 590 | Name: "emptyextension", |
| 591 | Tag: "varint,0,opt", |
| 592 | } |
| 593 | m := &pb2.MyMessage{} |
| 594 | if proto.HasExtension(m, desc) { |
| 595 | t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m)) |
| 596 | } |
| 597 | if err := proto.SetExtension(m, desc, proto.Bool(true)); err != nil { |
| 598 | t.Errorf("proto.SetExtension(m, desc, true): got error %q, want nil", err) |
| 599 | } |
| 600 | if !proto.HasExtension(m, desc) { |
| 601 | t.Errorf("proto.HasExtension(%s): got false, want true", proto.MarshalTextString(m)) |
| 602 | } |
| 603 | proto.ClearAllExtensions(m) |
| 604 | if proto.HasExtension(m, desc) { |
| 605 | t.Errorf("proto.HasExtension(%s): got true, want false", proto.MarshalTextString(m)) |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | func TestMarshalRace(t *testing.T) { |
| 610 | ext := &pb2.Ext{} |
nothing calls this directly
no test coverage detected