Commit 58dfce93 authored by Feng Xiao's avatar Feng Xiao

Update version number in descriptor.pb.h and plugin.pb.h. Protect death

tests with macro PROTOBUF_HAS_DEATH_TEST.
parent 81a630c6
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2006000 #if GOOGLE_PROTOBUF_VERSION < 3000000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 2006002 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
......
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2006000 #if GOOGLE_PROTOBUF_VERSION < 3000000
#error This file was generated by a newer version of protoc which is #error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 2006002 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.
......
...@@ -190,6 +190,7 @@ TEST_F(MapImplTest, MutableAt) { ...@@ -190,6 +190,7 @@ TEST_F(MapImplTest, MutableAt) {
ExpectSingleElement(key, value2); ExpectSingleElement(key, value2);
} }
#ifdef PROTOBUF_HAS_DEATH_TEST
TEST_F(MapImplTest, MutableAtNonExistDeathTest) { TEST_F(MapImplTest, MutableAtNonExistDeathTest) {
EXPECT_DEATH(map_.at(0), ""); EXPECT_DEATH(map_.at(0), "");
} }
...@@ -197,6 +198,7 @@ TEST_F(MapImplTest, MutableAtNonExistDeathTest) { ...@@ -197,6 +198,7 @@ TEST_F(MapImplTest, MutableAtNonExistDeathTest) {
TEST_F(MapImplTest, ImmutableAtNonExistDeathTest) { TEST_F(MapImplTest, ImmutableAtNonExistDeathTest) {
EXPECT_DEATH(const_map_.at(0), ""); EXPECT_DEATH(const_map_.at(0), "");
} }
#endif // PROTOBUF_HAS_DEATH_TEST
TEST_F(MapImplTest, CountNonExist) { TEST_F(MapImplTest, CountNonExist) {
EXPECT_EQ(0, map_.count(0)); EXPECT_EQ(0, map_.count(0));
......
...@@ -410,6 +410,7 @@ TEST(RepeatedFieldReflectionTest, RepeatedFieldRefForRegularFields) { ...@@ -410,6 +410,7 @@ TEST(RepeatedFieldReflectionTest, RepeatedFieldRefForRegularFields) {
EXPECT_TRUE(rf_message.empty()); EXPECT_TRUE(rf_message.empty());
EXPECT_TRUE(mrf_message.empty()); EXPECT_TRUE(mrf_message.empty());
#ifdef PROTOBUF_HAS_DEATH_TEST
// Make sure types are checked correctly at runtime. // Make sure types are checked correctly at runtime.
const FieldDescriptor* fd_optional_int32 = const FieldDescriptor* fd_optional_int32 =
desc->FindFieldByName("optional_int32"); desc->FindFieldByName("optional_int32");
...@@ -419,6 +420,7 @@ TEST(RepeatedFieldReflectionTest, RepeatedFieldRefForRegularFields) { ...@@ -419,6 +420,7 @@ TEST(RepeatedFieldReflectionTest, RepeatedFieldRefForRegularFields) {
message, fd_repeated_int32), ""); message, fd_repeated_int32), "");
EXPECT_DEATH(refl->GetRepeatedFieldRef<TestAllTypes>( EXPECT_DEATH(refl->GetRepeatedFieldRef<TestAllTypes>(
message, fd_repeated_foreign_message), ""); message, fd_repeated_foreign_message), "");
#endif // PROTOBUF_HAS_DEATH_TEST
} }
TEST(RepeatedFieldReflectionTest, RepeatedFieldRefForEnums) { TEST(RepeatedFieldReflectionTest, RepeatedFieldRefForEnums) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment