Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
40cd5d11
Unverified
Commit
40cd5d11
authored
Jul 19, 2018
by
Masaru Tsuchiyama
Committed by
GitHub
Jul 19, 2018
Browse files
Merge branch 'master' into feature/fix-build-error-vs2017-win10-jp
parents
234958de
1370e765
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1725 additions
and
2122 deletions
+1725
-2122
.gitignore
.gitignore
+3
-0
googlemock/include/gmock/internal/custom/gmock-matchers.h
googlemock/include/gmock/internal/custom/gmock-matchers.h
+1
-1
googlemock/test/gmock-actions_test.cc
googlemock/test/gmock-actions_test.cc
+0
-202
googlemock/test/gmock_ex_test.cc
googlemock/test/gmock_ex_test.cc
+2
-1
googletest/docs/advanced.md
googletest/docs/advanced.md
+1333
-1213
googletest/docs/faq.md
googletest/docs/faq.md
+379
-702
googletest/docs/primer.md
googletest/docs/primer.md
+6
-2
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+1
-1
No files found.
.gitignore
View file @
40cd5d11
...
...
@@ -38,3 +38,6 @@ googletest/m4/lt~obsolete.m4
# Ignore generated directories.
googlemock/fused-src/
googletest/fused-src/
# macOS files
.DS_Store
googlemock/include/gmock/internal/custom/gmock-matchers.h
View file @
40cd5d11
...
...
@@ -32,7 +32,7 @@
// ============================================================
//
// Adds google3 callback support to CallableTraits.
//
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
googlemock/test/gmock-actions_test.cc
View file @
40cd5d11
...
...
@@ -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
;
}
...
...
googlemock/test/gmock_ex_test.cc
View file @
40cd5d11
...
...
@@ -38,6 +38,7 @@
namespace
{
using
testing
::
HasSubstr
;
using
testing
::
internal
::
GoogleTestFailureException
;
// A type that cannot be default constructed.
...
...
@@ -53,7 +54,6 @@ class MockFoo {
MOCK_METHOD0
(
GetNonDefaultConstructible
,
NonDefaultConstructible
());
};
TEST
(
DefaultValueTest
,
ThrowsRuntimeErrorWhenNoDefaultValue
)
{
MockFoo
mock
;
try
{
...
...
@@ -76,5 +76,6 @@ TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) {
}
}
}
// unnamed namespace
#endif
googletest/docs/advanced.md
View file @
40cd5d11
This diff is collapsed.
Click to expand it.
googletest/docs/faq.md
View file @
40cd5d11
This diff is collapsed.
Click to expand it.
googletest/docs/primer.md
View file @
40cd5d11
This diff is collapsed.
Click to expand it.
googletest/include/gtest/internal/gtest-port.h
View file @
40cd5d11
This diff is collapsed.
Click to expand it.
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