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
f5d5b4de
Commit
f5d5b4de
authored
Dec 05, 2012
by
liujisi@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make custom option able to work for -f-no-rtti; Fix remaining death tests for gtest 1.6
parent
e34f1f63
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
15 deletions
+31
-15
cpp_unittest.cc
src/google/protobuf/compiler/cpp/cpp_unittest.cc
+11
-3
descriptor.cc
src/google/protobuf/descriptor.cc
+5
-1
extension_set_unittest.cc
src/google/protobuf/extension_set_unittest.cc
+6
-2
printer_unittest.cc
src/google/protobuf/io/printer_unittest.cc
+2
-2
tokenizer_unittest.cc
src/google/protobuf/io/tokenizer_unittest.cc
+6
-6
repeated_field_unittest.cc
src/google/protobuf/repeated_field_unittest.cc
+1
-1
No files found.
src/google/protobuf/compiler/cpp/cpp_unittest.cc
View file @
f5d5b4de
...
...
@@ -382,6 +382,8 @@ TEST(GeneratedMessageTest, StringCharStarLength) {
}
#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \
!defined(GOOGLE_PROTOBUF_NO_RTTI)
TEST
(
GeneratedMessageTest
,
CopyFrom
)
{
unittest
::
TestAllTypes
message1
,
message2
;
...
...
@@ -393,7 +395,7 @@ TEST(GeneratedMessageTest, CopyFrom) {
message2
.
CopyFrom
(
message2
);
TestUtil
::
ExpectAllFieldsSet
(
message2
);
}
#endif
TEST
(
GeneratedMessageTest
,
SwapWithEmpty
)
{
unittest
::
TestAllTypes
message1
,
message2
;
...
...
@@ -493,6 +495,8 @@ TEST(GeneratedMessageTest, CopyAssignmentOperator) {
TestUtil
::
ExpectAllFieldsSet
(
message2
);
}
#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \
!defined(GOOGLE_PROTOBUF_NO_RTTI)
TEST
(
GeneratedMessageTest
,
UpcastCopyFrom
)
{
// Test the CopyFrom method that takes in the generic const Message&
// parameter.
...
...
@@ -505,6 +509,7 @@ TEST(GeneratedMessageTest, UpcastCopyFrom) {
TestUtil
::
ExpectAllFieldsSet
(
message2
);
}
#endif
#ifndef PROTOBUF_TEST_NO_DESCRIPTORS
...
...
@@ -530,6 +535,8 @@ TEST(GeneratedMessageTest, DynamicMessageCopyFrom) {
#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
#if !defined(PROTOBUF_TEST_NO_DESCRIPTORS) || \
!defined(GOOGLE_PROTOBUF_NO_RTTI)
TEST
(
GeneratedMessageTest
,
NonEmptyMergeFrom
)
{
// Test merging with a non-empty message. Code is a modified form
// of that found in google/protobuf/reflection_ops_unittest.cc.
...
...
@@ -566,6 +573,7 @@ TEST(GeneratedMessageTest, MergeFromSelf) {
}
#endif // PROTOBUF_HAS_DEATH_TEST
#endif // !PROTOBUF_TEST_NO_DESCRIPTORS || !GOOGLE_PROTOBUF_NO_RTTI
// Test the generated SerializeWithCachedSizesToArray(),
TEST
(
GeneratedMessageTest
,
SerializationToArray
)
{
...
...
@@ -1199,7 +1207,7 @@ TEST_F(GeneratedServiceTest, CallMethod) {
TEST_F
(
GeneratedServiceTest
,
CallMethodTypeFailure
)
{
// Verify death if we call Foo() with Bar's message types.
#ifdef
GTEST
_HAS_DEATH_TEST // death tests do not work on Windows yet
#ifdef
PROTOBUF
_HAS_DEATH_TEST // death tests do not work on Windows yet
EXPECT_DEBUG_DEATH
(
mock_service_
.
CallMethod
(
foo_
,
&
mock_controller_
,
&
foo_request_
,
&
bar_response_
,
done_
.
get
()),
...
...
@@ -1210,7 +1218,7 @@ TEST_F(GeneratedServiceTest, CallMethodTypeFailure) {
mock_service_
.
CallMethod
(
foo_
,
&
mock_controller_
,
&
bar_request_
,
&
foo_response_
,
done_
.
get
()),
"dynamic_cast"
);
#endif //
GTEST
_HAS_DEATH_TEST
#endif //
PROTOBUF
_HAS_DEATH_TEST
}
TEST_F
(
GeneratedServiceTest
,
GetPrototypes
)
{
...
...
src/google/protobuf/descriptor.cc
View file @
f5d5b4de
...
...
@@ -2987,7 +2987,11 @@ template<class DescriptorT> void DescriptorBuilder::AllocateOptionsImpl(
// tables_->AllocateMessage<typename DescriptorT::OptionsType>();
typename
DescriptorT
::
OptionsType
*
const
dummy
=
NULL
;
typename
DescriptorT
::
OptionsType
*
options
=
tables_
->
AllocateMessage
(
dummy
);
options
->
CopyFrom
(
orig_options
);
// Avoid using MergeFrom()/CopyFrom() in this class to make it -fno-rtti
// friendly. Without RTTI, MergeFrom() and CopyFrom() will fallback to the
// reflection based method, which requires the Descriptor. However, we are in
// the middle of building the descriptors, thus the deadlock.
options
->
ParseFromString
(
orig_options
.
SerializeAsString
());
descriptor
->
options_
=
options
;
// Don't add to options_to_interpret_ unless there were uninterpreted
...
...
src/google/protobuf/extension_set_unittest.cc
View file @
f5d5b4de
...
...
@@ -550,7 +550,7 @@ TEST(ExtensionSetTest, SpaceUsedExcludingSelf) {
}
}
#ifdef
GTEST
_HAS_DEATH_TEST
#ifdef
PROTOBUF
_HAS_DEATH_TEST
TEST
(
ExtensionSetTest
,
InvalidEnumDeath
)
{
unittest
::
TestAllExtensions
message
;
...
...
@@ -560,7 +560,7 @@ TEST(ExtensionSetTest, InvalidEnumDeath) {
"IsValid"
);
}
#endif //
GTEST
_HAS_DEATH_TEST
#endif //
PROTOBUF
_HAS_DEATH_TEST
TEST
(
ExtensionSetTest
,
DynamicExtensions
)
{
// Test adding a dynamic extension to a compiled-in message object.
...
...
@@ -695,7 +695,11 @@ TEST(ExtensionSetTest, DynamicExtensions) {
const
Message
&
sub_message
=
message
.
GetReflection
()
->
GetMessage
(
message
,
message_extension
);
const
unittest
::
ForeignMessage
*
typed_sub_message
=
#ifdef GOOGLE_PROTOBUF_NO_RTTI
static_cast
<
const
unittest
::
ForeignMessage
*>
(
&
sub_message
);
#else
dynamic_cast
<
const
unittest
::
ForeignMessage
*>
(
&
sub_message
);
#endif
ASSERT_TRUE
(
typed_sub_message
!=
NULL
);
EXPECT_EQ
(
456
,
typed_sub_message
->
c
());
}
...
...
src/google/protobuf/io/printer_unittest.cc
View file @
f5d5b4de
...
...
@@ -220,7 +220,7 @@ TEST(Printer, Indenting) {
}
// Death tests do not work on Windows as of yet.
#ifdef
GTEST
_HAS_DEATH_TEST
#ifdef
PROTOBUF
_HAS_DEATH_TEST
TEST
(
Printer
,
Death
)
{
char
buffer
[
8192
];
...
...
@@ -231,7 +231,7 @@ TEST(Printer, Death) {
EXPECT_DEBUG_DEATH
(
printer
.
Print
(
"$unclosed"
),
"Unclosed variable name"
);
EXPECT_DEBUG_DEATH
(
printer
.
Outdent
(),
"without matching Indent"
);
}
#endif //
GTEST
_HAS_DEATH_TEST
#endif //
PROTOBUF_
_HAS_DEATH_TEST
TEST
(
Printer
,
WriteFailurePartial
)
{
char
buffer
[
17
];
...
...
src/google/protobuf/io/tokenizer_unittest.cc
View file @
f5d5b4de
...
...
@@ -741,7 +741,7 @@ TEST_F(TokenizerTest, ParseInteger) {
EXPECT_EQ
(
0
,
ParseInteger
(
"0x"
));
uint64
i
;
#ifdef
GTEST_HAS_
DEATH_TEST // death tests do not work on Windows yet
#ifdef
PROTOBUF_HAS
DEATH_TEST // death tests do not work on Windows yet
// Test invalid integers that will never be tokenized as integers.
EXPECT_DEBUG_DEATH
(
Tokenizer
::
ParseInteger
(
"zxy"
,
kuint64max
,
&
i
),
"passed text that could not have been tokenized as an integer"
);
...
...
@@ -753,7 +753,7 @@ TEST_F(TokenizerTest, ParseInteger) {
"passed text that could not have been tokenized as an integer"
);
EXPECT_DEBUG_DEATH
(
Tokenizer
::
ParseInteger
(
"-1"
,
kuint64max
,
&
i
),
"passed text that could not have been tokenized as an integer"
);
#endif //
GTEST_HAS_
DEATH_TEST
#endif //
PROTOBUF_HAS
DEATH_TEST
// Test overflows.
EXPECT_TRUE
(
Tokenizer
::
ParseInteger
(
"0"
,
0
,
&
i
));
...
...
@@ -796,7 +796,7 @@ TEST_F(TokenizerTest, ParseFloat) {
EXPECT_EQ
(
0.0
,
Tokenizer
::
ParseFloat
(
"1e-9999999999999999999999999999"
));
EXPECT_EQ
(
HUGE_VAL
,
Tokenizer
::
ParseFloat
(
"1e+9999999999999999999999999999"
));
#ifdef
GTEST_HAS_
DEATH_TEST // death tests do not work on Windows yet
#ifdef
PROTOBUF_HAS
DEATH_TEST // death tests do not work on Windows yet
// Test invalid integers that will never be tokenized as integers.
EXPECT_DEBUG_DEATH
(
Tokenizer
::
ParseFloat
(
"zxy"
),
"passed text that could not have been tokenized as a float"
);
...
...
@@ -804,7 +804,7 @@ TEST_F(TokenizerTest, ParseFloat) {
"passed text that could not have been tokenized as a float"
);
EXPECT_DEBUG_DEATH
(
Tokenizer
::
ParseFloat
(
"-1.0"
),
"passed text that could not have been tokenized as a float"
);
#endif //
GTEST_HAS_
DEATH_TEST
#endif //
PROTOBUF_HAS
DEATH_TEST
}
TEST_F
(
TokenizerTest
,
ParseString
)
{
...
...
@@ -843,10 +843,10 @@ TEST_F(TokenizerTest, ParseString) {
EXPECT_EQ
(
"u0"
,
output
);
// Test invalid strings that will never be tokenized as strings.
#ifdef
GTEST_HAS_
DEATH_TEST // death tests do not work on Windows yet
#ifdef
PROTOBUF_HAS
DEATH_TEST // death tests do not work on Windows yet
EXPECT_DEBUG_DEATH
(
Tokenizer
::
ParseString
(
""
,
&
output
),
"passed text that could not have been tokenized as a string"
);
#endif //
GTEST_HAS_
DEATH_TEST
#endif //
PROTOBUF_HAS
DEATH_TEST
}
TEST_F
(
TokenizerTest
,
ParseStringAppend
)
{
...
...
src/google/protobuf/repeated_field_unittest.cc
View file @
f5d5b4de
...
...
@@ -331,7 +331,7 @@ TEST(RepeatedField, Truncate) {
// Truncations that don't change the size are allowed, but growing is not
// allowed.
field
.
Truncate
(
field
.
size
());
#ifdef
GTEST
_HAS_DEATH_TEST
#ifdef
PROTOBUF
_HAS_DEATH_TEST
EXPECT_DEBUG_DEATH
(
field
.
Truncate
(
field
.
size
()
+
1
),
"new_size"
);
#endif
}
...
...
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