summaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock-actions_test.cc
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2018-07-18 11:30:36 -0400
committerGennadiy Civil <misterg@google.com>2018-07-18 11:30:36 -0400
commit8d07cfd0532352379c624ce8844aeca0dc68a585 (patch)
tree7fbcd68087bb58aa4ba07c28ac19ef1884963388 /googlemock/test/gmock-actions_test.cc
parent7e73a7ae6e665e3a9e34543090625ab8278412bb (diff)
downloadgoogletest-8d07cfd0532352379c624ce8844aeca0dc68a585.tar.gz
googletest-8d07cfd0532352379c624ce8844aeca0dc68a585.zip
Code sync, mostly formatting and removing outdates
Diffstat (limited to 'googlemock/test/gmock-actions_test.cc')
-rw-r--r--googlemock/test/gmock-actions_test.cc202
1 files changed, 0 insertions, 202 deletions
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc
index 7fbb50d3..e8bdbee7 100644
--- a/googlemock/test/gmock-actions_test.cc
+++ b/googlemock/test/gmock-actions_test.cc
@@ -88,10 +88,6 @@ using testing::tuple_element;
using testing::SetErrnoAndReturn;
#endif
-#if GTEST_HAS_PROTOBUF_
-using testing::internal::TestMessage;
-#endif // GTEST_HAS_PROTOBUF_
-
// Tests that BuiltInDefaultValue<T*>::Get() returns NULL.
TEST(BuiltInDefaultValueTest, IsNullForPointerTypes) {
EXPECT_TRUE(BuiltInDefaultValue<int*>::Get() == NULL);
@@ -895,105 +891,6 @@ TEST(SetArgPointeeTest, AcceptsWideCharPointer) {
# endif
}
-#if GTEST_HAS_PROTOBUF_
-
-// Tests that SetArgPointee<N>(proto_buffer) sets the v1 protobuf
-// variable pointed to by the N-th (0-based) argument to proto_buffer.
-TEST(SetArgPointeeTest, SetsTheNthPointeeOfProtoBufferType) {
- TestMessage* const msg = new TestMessage;
- msg->set_member("yes");
- TestMessage orig_msg;
- orig_msg.CopyFrom(*msg);
-
- Action<void(bool, TestMessage*)> a = SetArgPointee<1>(*msg);
- // SetArgPointee<N>(proto_buffer) makes a copy of proto_buffer
- // s.t. the action works even when the original proto_buffer has
- // died. We ensure this behavior by deleting msg before using the
- // action.
- delete msg;
-
- TestMessage dest;
- EXPECT_FALSE(orig_msg.Equals(dest));
- a.Perform(make_tuple(true, &dest));
- EXPECT_TRUE(orig_msg.Equals(dest));
-}
-
-// Tests that SetArgPointee<N>(proto_buffer) sets the
-// ::ProtocolMessage variable pointed to by the N-th (0-based)
-// argument to proto_buffer.
-TEST(SetArgPointeeTest, SetsTheNthPointeeOfProtoBufferBaseType) {
- TestMessage* const msg = new TestMessage;
- msg->set_member("yes");
- TestMessage orig_msg;
- orig_msg.CopyFrom(*msg);
-
- Action<void(bool, ::ProtocolMessage*)> a = SetArgPointee<1>(*msg);
- // SetArgPointee<N>(proto_buffer) makes a copy of proto_buffer
- // s.t. the action works even when the original proto_buffer has
- // died. We ensure this behavior by deleting msg before using the
- // action.
- delete msg;
-
- TestMessage dest;
- ::ProtocolMessage* const dest_base = &dest;
- EXPECT_FALSE(orig_msg.Equals(dest));
- a.Perform(make_tuple(true, dest_base));
- EXPECT_TRUE(orig_msg.Equals(dest));
-}
-
-// Tests that SetArgPointee<N>(proto2_buffer) sets the v2
-// protobuf variable pointed to by the N-th (0-based) argument to
-// proto2_buffer.
-TEST(SetArgPointeeTest, SetsTheNthPointeeOfProto2BufferType) {
- using testing::internal::FooMessage;
- FooMessage* const msg = new FooMessage;
- msg->set_int_field(2);
- msg->set_string_field("hi");
- FooMessage orig_msg;
- orig_msg.CopyFrom(*msg);
-
- Action<void(bool, FooMessage*)> a = SetArgPointee<1>(*msg);
- // SetArgPointee<N>(proto2_buffer) makes a copy of
- // proto2_buffer s.t. the action works even when the original
- // proto2_buffer has died. We ensure this behavior by deleting msg
- // before using the action.
- delete msg;
-
- FooMessage dest;
- dest.set_int_field(0);
- a.Perform(make_tuple(true, &dest));
- EXPECT_EQ(2, dest.int_field());
- EXPECT_EQ("hi", dest.string_field());
-}
-
-// Tests that SetArgPointee<N>(proto2_buffer) sets the
-// proto2::Message variable pointed to by the N-th (0-based) argument
-// to proto2_buffer.
-TEST(SetArgPointeeTest, SetsTheNthPointeeOfProto2BufferBaseType) {
- using testing::internal::FooMessage;
- FooMessage* const msg = new FooMessage;
- msg->set_int_field(2);
- msg->set_string_field("hi");
- FooMessage orig_msg;
- orig_msg.CopyFrom(*msg);
-
- Action<void(bool, ::proto2::Message*)> a = SetArgPointee<1>(*msg);
- // SetArgPointee<N>(proto2_buffer) makes a copy of
- // proto2_buffer s.t. the action works even when the original
- // proto2_buffer has died. We ensure this behavior by deleting msg
- // before using the action.
- delete msg;
-
- FooMessage dest;
- dest.set_int_field(0);
- ::proto2::Message* const dest_base = &dest;
- a.Perform(make_tuple(true, dest_base));
- EXPECT_EQ(2, dest.int_field());
- EXPECT_EQ("hi", dest.string_field());
-}
-
-#endif // GTEST_HAS_PROTOBUF_
-
// Tests that SetArgumentPointee<N>(v) sets the variable pointed to by
// the N-th (0-based) argument to v.
TEST(SetArgumentPointeeTest, SetsTheNthPointee) {
@@ -1014,105 +911,6 @@ TEST(SetArgumentPointeeTest, SetsTheNthPointee) {
EXPECT_EQ('a', ch);
}
-#if GTEST_HAS_PROTOBUF_
-
-// Tests that SetArgumentPointee<N>(proto_buffer) sets the v1 protobuf
-// variable pointed to by the N-th (0-based) argument to proto_buffer.
-TEST(SetArgumentPointeeTest, SetsTheNthPointeeOfProtoBufferType) {
- TestMessage* const msg = new TestMessage;
- msg->set_member("yes");
- TestMessage orig_msg;
- orig_msg.CopyFrom(*msg);
-
- Action<void(bool, TestMessage*)> a = SetArgumentPointee<1>(*msg);
- // SetArgumentPointee<N>(proto_buffer) makes a copy of proto_buffer
- // s.t. the action works even when the original proto_buffer has
- // died. We ensure this behavior by deleting msg before using the
- // action.
- delete msg;
-
- TestMessage dest;
- EXPECT_FALSE(orig_msg.Equals(dest));
- a.Perform(make_tuple(true, &dest));
- EXPECT_TRUE(orig_msg.Equals(dest));
-}
-
-// Tests that SetArgumentPointee<N>(proto_buffer) sets the
-// ::ProtocolMessage variable pointed to by the N-th (0-based)
-// argument to proto_buffer.
-TEST(SetArgumentPointeeTest, SetsTheNthPointeeOfProtoBufferBaseType) {
- TestMessage* const msg = new TestMessage;
- msg->set_member("yes");
- TestMessage orig_msg;
- orig_msg.CopyFrom(*msg);
-
- Action<void(bool, ::ProtocolMessage*)> a = SetArgumentPointee<1>(*msg);
- // SetArgumentPointee<N>(proto_buffer) makes a copy of proto_buffer
- // s.t. the action works even when the original proto_buffer has
- // died. We ensure this behavior by deleting msg before using the
- // action.
- delete msg;
-
- TestMessage dest;
- ::ProtocolMessage* const dest_base = &dest;
- EXPECT_FALSE(orig_msg.Equals(dest));
- a.Perform(make_tuple(true, dest_base));
- EXPECT_TRUE(orig_msg.Equals(dest));
-}
-
-// Tests that SetArgumentPointee<N>(proto2_buffer) sets the v2
-// protobuf variable pointed to by the N-th (0-based) argument to
-// proto2_buffer.
-TEST(SetArgumentPointeeTest, SetsTheNthPointeeOfProto2BufferType) {
- using testing::internal::FooMessage;
- FooMessage* const msg = new FooMessage;
- msg->set_int_field(2);
- msg->set_string_field("hi");
- FooMessage orig_msg;
- orig_msg.CopyFrom(*msg);
-
- Action<void(bool, FooMessage*)> a = SetArgumentPointee<1>(*msg);
- // SetArgumentPointee<N>(proto2_buffer) makes a copy of
- // proto2_buffer s.t. the action works even when the original
- // proto2_buffer has died. We ensure this behavior by deleting msg
- // before using the action.
- delete msg;
-
- FooMessage dest;
- dest.set_int_field(0);
- a.Perform(make_tuple(true, &dest));
- EXPECT_EQ(2, dest.int_field());
- EXPECT_EQ("hi", dest.string_field());
-}
-
-// Tests that SetArgumentPointee<N>(proto2_buffer) sets the
-// proto2::Message variable pointed to by the N-th (0-based) argument
-// to proto2_buffer.
-TEST(SetArgumentPointeeTest, SetsTheNthPointeeOfProto2BufferBaseType) {
- using testing::internal::FooMessage;
- FooMessage* const msg = new FooMessage;
- msg->set_int_field(2);
- msg->set_string_field("hi");
- FooMessage orig_msg;
- orig_msg.CopyFrom(*msg);
-
- Action<void(bool, ::proto2::Message*)> a = SetArgumentPointee<1>(*msg);
- // SetArgumentPointee<N>(proto2_buffer) makes a copy of
- // proto2_buffer s.t. the action works even when the original
- // proto2_buffer has died. We ensure this behavior by deleting msg
- // before using the action.
- delete msg;
-
- FooMessage dest;
- dest.set_int_field(0);
- ::proto2::Message* const dest_base = &dest;
- a.Perform(make_tuple(true, dest_base));
- EXPECT_EQ(2, dest.int_field());
- EXPECT_EQ("hi", dest.string_field());
-}
-
-#endif // GTEST_HAS_PROTOBUF_
-
// Sample functions and functors for testing Invoke() and etc.
int Nullary() { return 1; }
OpenPOWER on IntegriCloud