Update gtest to 1.6; Disable death tests when exceptions are enabled.

pull/3335/head
liujisi@google.com 12 years ago
parent e719489061
commit 1d32532ead
  1. 4
      src/google/protobuf/compiler/cpp/cpp_unittest.cc
  2. 4
      src/google/protobuf/generated_message_reflection_unittest.cc
  3. 4
      src/google/protobuf/message_unittest.cc
  4. 4
      src/google/protobuf/reflection_ops_unittest.cc
  5. 2
      src/google/protobuf/repeated_field_reflection_unittest.cc
  6. 5
      src/google/protobuf/testing/googletest.h

@ -556,7 +556,7 @@ TEST(GeneratedMessageTest, NonEmptyMergeFrom) {
TestUtil::ExpectAllFieldsSet(message1);
}
#ifdef GTEST_HAS_DEATH_TEST
#ifdef PROTOBUF_HAS_DEATH_TEST
TEST(GeneratedMessageTest, MergeFromSelf) {
unittest::TestAllTypes message;
@ -565,7 +565,7 @@ TEST(GeneratedMessageTest, MergeFromSelf) {
"&from");
}
#endif // GTEST_HAS_DEATH_TEST
#endif // PROTOBUF_HAS_DEATH_TEST
// Test the generated SerializeWithCachedSizesToArray(),
TEST(GeneratedMessageTest, SerializationToArray) {

@ -427,7 +427,7 @@ TEST(GeneratedMessageReflectionTest, ReleaseExtensionMessageTest) {
TestUtil::ExpectAllExtensionsSet(message);
}
#ifdef GTEST_HAS_DEATH_TEST
#ifdef PROTOBUF_HAS_DEATH_TEST
TEST(GeneratedMessageReflectionTest, UsageErrors) {
unittest::TestAllTypes message;
@ -476,7 +476,7 @@ TEST(GeneratedMessageReflectionTest, UsageErrors) {
#undef f
}
#endif // GTEST_HAS_DEATH_TEST
#endif // PROTOBUF_HAS_DEATH_TEST
} // namespace

@ -205,7 +205,7 @@ TEST(MessageTest, InitializationErrorString) {
EXPECT_EQ("a, b, c", message.InitializationErrorString());
}
#ifdef GTEST_HAS_DEATH_TEST // death tests do not work on Windows yet.
#ifdef PROTOBUF_HAS_DEATH_TEST
TEST(MessageTest, SerializeFailsIfNotInitialized) {
unittest::TestRequired message;
@ -222,7 +222,7 @@ TEST(MessageTest, CheckInitialized) {
"fields: a, b, c");
}
#endif // GTEST_HAS_DEATH_TEST
#endif // PROTOBUF_HAS_DEATH_TEST
TEST(MessageTest, BypassInitializationCheckOnSerialize) {
unittest::TestRequired message;

@ -152,7 +152,7 @@ TEST(ReflectionOpsTest, MergeUnknown) {
EXPECT_EQ(2, message1.unknown_fields().field(1).varint());
}
#ifdef GTEST_HAS_DEATH_TEST
#ifdef PROTOBUF_HAS_DEATH_TEST
TEST(ReflectionOpsTest, MergeFromSelf) {
// Note: Copy is implemented in terms of Merge() so technically the Copy
@ -165,7 +165,7 @@ TEST(ReflectionOpsTest, MergeFromSelf) {
"&from");
}
#endif // GTEST_HAS_DEATH_TEST
#endif // PROTOBUF_HAS_DEATH_TEST
TEST(ReflectionOpsTest, Clear) {
unittest::TestAllTypes message;

@ -144,6 +144,7 @@ TEST(RepeatedFieldReflectionTest, RegularFields) {
EXPECT_EQ(message.repeated_foreign_message(i).c(), Func(i, 7));
}
#ifdef PROTOBUF_HAS_DEATH_TEST
// Make sure types are checked correctly at runtime.
const FieldDescriptor* fd_optional_int32 =
desc->FindFieldByName("optional_int32");
@ -153,6 +154,7 @@ TEST(RepeatedFieldReflectionTest, RegularFields) {
message, fd_repeated_int32), "not the right type");
EXPECT_DEATH(refl->GetRepeatedPtrField<TestAllTypes>(
message, fd_repeated_foreign_message), "wrong submessage type");
#endif // PROTOBUF_HAS_DEATH_TEST
}

@ -38,6 +38,11 @@
#include <vector>
#include <google/protobuf/stubs/common.h>
// Disable death tests if we use exceptions in CHECK().
#if !PROTOBUF_USE_EXCEPTIONS && defined(GTEST_HAS_DEATH_TEST)
#define PROTOBUF_HAS_DEATH_TEST
#endif
namespace google {
namespace protobuf {

Loading…
Cancel
Save