Skip to content

Commit c74ae87

Browse files
committed
fix(generator): skip RedactedField test when Protobuf lacks public SetRedactDebugString
1 parent 83c0b09 commit c74ae87

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

google/cloud/internal/debug_string_protobuf_test.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,21 @@ TEST(LogWrapperHelpers, Timestamp) {
134134
"single_line_mode=off")));
135135
}
136136

137+
template <
138+
typename Printer,
139+
typename = decltype(std::declval<Printer&>().SetRedactDebugString(true))>
140+
std::true_type SupportsRedact(int);
141+
142+
template <typename Printer>
143+
std::false_type SupportsRedact(...);
144+
137145
TEST(LogWrapperHelpers, RedactedField) {
146+
if (!decltype(SupportsRedact<google::protobuf::TextFormat::Printer>(
147+
0))::value) {
148+
GTEST_SKIP()
149+
<< "SetRedactDebugString is not supported in this Protobuf version";
150+
}
151+
138152
google::protobuf::FileDescriptorProto file_proto;
139153
file_proto.set_name("test_redact.proto");
140154
file_proto.set_syntax("proto3");

0 commit comments

Comments
 (0)