Skip to content

Commit f4e96ec

Browse files
authored
Compile tests even if we don't run them (#277)
1 parent dee137d commit f4e96ec

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/mutator_test.cc

+6-14
Original file line numberDiff line numberDiff line change
@@ -678,23 +678,18 @@ TYPED_TEST(MutatorTypedTest, Serialization) {
678678
}
679679

680680
TYPED_TEST(MutatorTypedTest, UnknownFieldTextFormat) {
681-
// NOTE: This test has little chance of passing when method
682-
// TextFormat::Parser::AllowUnknownField is not available
683-
#if GOOGLE_PROTOBUF_VERSION >= 3008000 // commit 176f7db11d8242b36a3ea6abb1cc436fca5bf75d of >=3.8.0
681+
#if GOOGLE_PROTOBUF_VERSION < 3008000 // commit 176f7db11d8242b36a3ea6abb1cc436fca5bf75d of >=3.8.0
682+
GTEST_SKIP() << "TextFormat::Parser::AllowUnknownField() is not available";
683+
#endif // GOOGLE_PROTOBUF_VERSION
684684
typename TestFixture::Message parsed;
685685
EXPECT_TRUE(ParseTextMessage(kUnknownFieldInput, &parsed));
686686
EXPECT_EQ(SaveMessageAsText(parsed), kUnknownFieldExpected);
687-
#else
688-
(void)kUnknownFieldExpected;
689-
(void)kUnknownFieldInput;
690-
GTEST_SKIP();
691-
#endif // GOOGLE_PROTOBUF_VERSION
692687
}
693688

694689
TYPED_TEST(MutatorTypedTest, DeepRecursion) {
695-
// NOTE: This test has little chance of passing when method
696-
// TextFormat::Parser::SetRecursionLimit is not available
697-
#if GOOGLE_PROTOBUF_VERSION >= 3008000 // commit d8c2501b43c1b56e3efa74048a18f8ce06ba07fe of >=3.8.0
690+
#if GOOGLE_PROTOBUF_VERSION < 3008000 // commit d8c2501b43c1b56e3efa74048a18f8ce06ba07fe of >=3.8.0
691+
GTEST_SKIP() << "TextFormat::Parser::SetRecursionLimit() is not available";
692+
#endif // GOOGLE_PROTOBUF_VERSION
698693
typename TestFixture::Message message;
699694
typename TestFixture::Message* last = &message;
700695
for (int i = 0; i < 150; ++i) {
@@ -706,9 +701,6 @@ TYPED_TEST(MutatorTypedTest, DeepRecursion) {
706701
EXPECT_EQ(i < 100,
707702
ParseBinaryMessage(SaveMessageAsBinary(message), &parsed));
708703
}
709-
#else
710-
GTEST_SKIP();
711-
#endif // GOOGLE_PROTOBUF_VERSION
712704
}
713705

714706
TYPED_TEST(MutatorTypedTest, EmptyMessage) {

0 commit comments

Comments
 (0)