Skip to content

Commit

Permalink
Prepare code for breaking change in Protobuf C++ API.
Browse files Browse the repository at this point in the history
Protobuf 6.30.0 will change the return types of Descriptor::name() and other methods to absl::string_view. This makes the code work both before and after such a change.

PiperOrigin-RevId: 684597086
  • Loading branch information
evalon32 authored and copybara-github committed Oct 10, 2024
1 parent 8a3d2cd commit 4885d60
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tensorflow_federated/cc/testing/protobuf_matchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "googlemock/include/gmock/gmock.h"
#include "googletest/include/gtest/gtest.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "google/protobuf/io/tokenizer.h"
Expand Down Expand Up @@ -176,8 +177,8 @@ class ProtoMatcherBase {
// Assumes that the types actually mismatch.
std::string DescribeTypeMismatch(const google::protobuf::Message &expected,
const google::protobuf::Message &actual) const {
return "whose type should be " + expected.GetTypeName() +
" but actually is " + actual.GetTypeName();
return absl::StrCat("whose type should be ", expected.GetTypeName(),
" but actually is ", actual.GetTypeName());
}

// Provides a string describing the difference between the two given protos.
Expand Down

0 comments on commit 4885d60

Please sign in to comment.