Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
1d32532e
Commit
1d32532e
authored
Dec 04, 2012
by
liujisi@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update gtest to 1.6; Disable death tests when exceptions are enabled.
parent
e7194890
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
8 deletions
+15
-8
cpp_unittest.cc
src/google/protobuf/compiler/cpp/cpp_unittest.cc
+2
-2
generated_message_reflection_unittest.cc
src/google/protobuf/generated_message_reflection_unittest.cc
+2
-2
message_unittest.cc
src/google/protobuf/message_unittest.cc
+2
-2
reflection_ops_unittest.cc
src/google/protobuf/reflection_ops_unittest.cc
+2
-2
repeated_field_reflection_unittest.cc
src/google/protobuf/repeated_field_reflection_unittest.cc
+2
-0
googletest.h
src/google/protobuf/testing/googletest.h
+5
-0
No files found.
src/google/protobuf/compiler/cpp/cpp_unittest.cc
View file @
1d32532e
...
@@ -556,7 +556,7 @@ TEST(GeneratedMessageTest, NonEmptyMergeFrom) {
...
@@ -556,7 +556,7 @@ TEST(GeneratedMessageTest, NonEmptyMergeFrom) {
TestUtil
::
ExpectAllFieldsSet
(
message1
);
TestUtil
::
ExpectAllFieldsSet
(
message1
);
}
}
#ifdef
GTEST
_HAS_DEATH_TEST
#ifdef
PROTOBUF
_HAS_DEATH_TEST
TEST
(
GeneratedMessageTest
,
MergeFromSelf
)
{
TEST
(
GeneratedMessageTest
,
MergeFromSelf
)
{
unittest
::
TestAllTypes
message
;
unittest
::
TestAllTypes
message
;
...
@@ -565,7 +565,7 @@ TEST(GeneratedMessageTest, MergeFromSelf) {
...
@@ -565,7 +565,7 @@ TEST(GeneratedMessageTest, MergeFromSelf) {
"&from"
);
"&from"
);
}
}
#endif //
GTEST
_HAS_DEATH_TEST
#endif //
PROTOBUF
_HAS_DEATH_TEST
// Test the generated SerializeWithCachedSizesToArray(),
// Test the generated SerializeWithCachedSizesToArray(),
TEST
(
GeneratedMessageTest
,
SerializationToArray
)
{
TEST
(
GeneratedMessageTest
,
SerializationToArray
)
{
...
...
src/google/protobuf/generated_message_reflection_unittest.cc
View file @
1d32532e
...
@@ -427,7 +427,7 @@ TEST(GeneratedMessageReflectionTest, ReleaseExtensionMessageTest) {
...
@@ -427,7 +427,7 @@ TEST(GeneratedMessageReflectionTest, ReleaseExtensionMessageTest) {
TestUtil
::
ExpectAllExtensionsSet
(
message
);
TestUtil
::
ExpectAllExtensionsSet
(
message
);
}
}
#ifdef
GTEST
_HAS_DEATH_TEST
#ifdef
PROTOBUF
_HAS_DEATH_TEST
TEST
(
GeneratedMessageReflectionTest
,
UsageErrors
)
{
TEST
(
GeneratedMessageReflectionTest
,
UsageErrors
)
{
unittest
::
TestAllTypes
message
;
unittest
::
TestAllTypes
message
;
...
@@ -476,7 +476,7 @@ TEST(GeneratedMessageReflectionTest, UsageErrors) {
...
@@ -476,7 +476,7 @@ TEST(GeneratedMessageReflectionTest, UsageErrors) {
#undef f
#undef f
}
}
#endif //
GTEST
_HAS_DEATH_TEST
#endif //
PROTOBUF
_HAS_DEATH_TEST
}
// namespace
}
// namespace
...
...
src/google/protobuf/message_unittest.cc
View file @
1d32532e
...
@@ -205,7 +205,7 @@ TEST(MessageTest, InitializationErrorString) {
...
@@ -205,7 +205,7 @@ TEST(MessageTest, InitializationErrorString) {
EXPECT_EQ
(
"a, b, c"
,
message
.
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
)
{
TEST
(
MessageTest
,
SerializeFailsIfNotInitialized
)
{
unittest
::
TestRequired
message
;
unittest
::
TestRequired
message
;
...
@@ -222,7 +222,7 @@ TEST(MessageTest, CheckInitialized) {
...
@@ -222,7 +222,7 @@ TEST(MessageTest, CheckInitialized) {
"fields: a, b, c"
);
"fields: a, b, c"
);
}
}
#endif //
GTEST
_HAS_DEATH_TEST
#endif //
PROTOBUF
_HAS_DEATH_TEST
TEST
(
MessageTest
,
BypassInitializationCheckOnSerialize
)
{
TEST
(
MessageTest
,
BypassInitializationCheckOnSerialize
)
{
unittest
::
TestRequired
message
;
unittest
::
TestRequired
message
;
...
...
src/google/protobuf/reflection_ops_unittest.cc
View file @
1d32532e
...
@@ -152,7 +152,7 @@ TEST(ReflectionOpsTest, MergeUnknown) {
...
@@ -152,7 +152,7 @@ TEST(ReflectionOpsTest, MergeUnknown) {
EXPECT_EQ
(
2
,
message1
.
unknown_fields
().
field
(
1
).
varint
());
EXPECT_EQ
(
2
,
message1
.
unknown_fields
().
field
(
1
).
varint
());
}
}
#ifdef
GTEST
_HAS_DEATH_TEST
#ifdef
PROTOBUF
_HAS_DEATH_TEST
TEST
(
ReflectionOpsTest
,
MergeFromSelf
)
{
TEST
(
ReflectionOpsTest
,
MergeFromSelf
)
{
// Note: Copy is implemented in terms of Merge() so technically the Copy
// Note: Copy is implemented in terms of Merge() so technically the Copy
...
@@ -165,7 +165,7 @@ TEST(ReflectionOpsTest, MergeFromSelf) {
...
@@ -165,7 +165,7 @@ TEST(ReflectionOpsTest, MergeFromSelf) {
"&from"
);
"&from"
);
}
}
#endif //
GTEST
_HAS_DEATH_TEST
#endif //
PROTOBUF
_HAS_DEATH_TEST
TEST
(
ReflectionOpsTest
,
Clear
)
{
TEST
(
ReflectionOpsTest
,
Clear
)
{
unittest
::
TestAllTypes
message
;
unittest
::
TestAllTypes
message
;
...
...
src/google/protobuf/repeated_field_reflection_unittest.cc
View file @
1d32532e
...
@@ -144,6 +144,7 @@ TEST(RepeatedFieldReflectionTest, RegularFields) {
...
@@ -144,6 +144,7 @@ TEST(RepeatedFieldReflectionTest, RegularFields) {
EXPECT_EQ
(
message
.
repeated_foreign_message
(
i
).
c
(),
Func
(
i
,
7
));
EXPECT_EQ
(
message
.
repeated_foreign_message
(
i
).
c
(),
Func
(
i
,
7
));
}
}
#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"
);
...
@@ -153,6 +154,7 @@ TEST(RepeatedFieldReflectionTest, RegularFields) {
...
@@ -153,6 +154,7 @@ TEST(RepeatedFieldReflectionTest, RegularFields) {
message
,
fd_repeated_int32
),
"not the right type"
);
message
,
fd_repeated_int32
),
"not the right type"
);
EXPECT_DEATH
(
refl
->
GetRepeatedPtrField
<
TestAllTypes
>
(
EXPECT_DEATH
(
refl
->
GetRepeatedPtrField
<
TestAllTypes
>
(
message
,
fd_repeated_foreign_message
),
"wrong submessage type"
);
message
,
fd_repeated_foreign_message
),
"wrong submessage type"
);
#endif // PROTOBUF_HAS_DEATH_TEST
}
}
...
...
src/google/protobuf/testing/googletest.h
View file @
1d32532e
...
@@ -38,6 +38,11 @@
...
@@ -38,6 +38,11 @@
#include <vector>
#include <vector>
#include <google/protobuf/stubs/common.h>
#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
google
{
namespace
protobuf
{
namespace
protobuf
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment