From 1b50271ca2923eb05e9edb3c96fe00033940740b Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 5 Feb 2023 18:00:38 -0800 Subject: [PATCH] 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 --- upb/util/def_to_proto_test.cc | 11 +++++++++++ upb/util/def_to_proto_test.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/upb/util/def_to_proto_test.cc b/upb/util/def_to_proto_test.cc index 18d2304401..e5d4b37086 100644 --- a/upb/util/def_to_proto_test.cc +++ b/upb/util/def_to_proto_test.cc @@ -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) { diff --git a/upb/util/def_to_proto_test.h b/upb/util/def_to_proto_test.h index 809a7cab46..7668223858 100644 --- a/upb/util/def_to_proto_test.h +++ b/upb/util/def_to_proto_test.h @@ -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; }