Fixed a bug in the matcher that caused false positives.

Previously we were calling the static method `Equals()` which did not take into effect the custom comparator or string for reporting errors.

PiperOrigin-RevId: 507344425
pull/13171/head
Joshua Haberman 2 years ago committed by Copybara-Service
parent 65e7d4a3d9
commit 1b50271ca2
  1. 11
      upb/util/def_to_proto_test.cc
  2. 2
      upb/util/def_to_proto_test.h

@ -270,6 +270,17 @@ TEST(FuzzTest, DefaultWithValidHexEscapePrintable) {
// weak_dependency: 0
// })pb"));
// }
//
// TEST(FuzzTest, NanInOptions) {
// RoundTripDescriptor(
// ParseTextProtoOrDie(R"pb(file {
// name: ""
// service {
// name: "A"
// options { failure_detection_delay: nan }
// }
// })pb"));
// }
// end:google_only
TEST(FuzzTest, PackageStartsWithNumber) {

@ -30,7 +30,7 @@ MATCHER_P(EqualsProtoTreatNansAsEqual, proto,
google::protobuf::util::MessageDifferencer differencer;
differencer.set_field_comparator(&comparator);
differencer.ReportDifferencesToString(&differences);
bool eq = differencer.Equals(proto, arg);
bool eq = differencer.Compare(proto, arg);
if (!eq) {
*result_listener << differences;
}

Loading…
Cancel
Save