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
a9bd428e
"git@developer.sourcefind.cn:gaoqiong/pybind11.git" did not exist on "0f82a0b01482037554689dd945c3b10fcc9792cb"
Unverified
Commit
a9bd428e
authored
Aug 17, 2018
by
Gennadiy Civil
Committed by
GitHub
Aug 17, 2018
Browse files
Merge branch 'master' into fix-msvc-d9025-warning
parents
421e7b4f
02a8ca87
Changes
203
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
50 additions
and
255 deletions
+50
-255
googlemock/test/gmock-actions_test.cc
googlemock/test/gmock-actions_test.cc
+2
-205
googlemock/test/gmock-cardinalities_test.cc
googlemock/test/gmock-cardinalities_test.cc
+1
-2
googlemock/test/gmock-generated-actions_test.cc
googlemock/test/gmock-generated-actions_test.cc
+1
-2
googlemock/test/gmock-generated-function-mockers_test.cc
googlemock/test/gmock-generated-function-mockers_test.cc
+1
-2
googlemock/test/gmock-generated-internal-utils_test.cc
googlemock/test/gmock-generated-internal-utils_test.cc
+1
-2
googlemock/test/gmock-internal-utils_test.cc
googlemock/test/gmock-internal-utils_test.cc
+1
-2
googlemock/test/gmock-matchers_test.cc
googlemock/test/gmock-matchers_test.cc
+25
-5
googlemock/test/gmock-more-actions_test.cc
googlemock/test/gmock-more-actions_test.cc
+1
-2
googlemock/test/gmock-nice-strict_test.cc
googlemock/test/gmock-nice-strict_test.cc
+1
-2
googlemock/test/gmock-port_test.cc
googlemock/test/gmock-port_test.cc
+1
-2
googlemock/test/gmock-spec-builders_test.cc
googlemock/test/gmock-spec-builders_test.cc
+2
-3
googlemock/test/gmock_all_test.cc
googlemock/test/gmock_all_test.cc
+1
-2
googlemock/test/gmock_ex_test.cc
googlemock/test/gmock_ex_test.cc
+4
-5
googlemock/test/gmock_leak_test.py
googlemock/test/gmock_leak_test.py
+0
-4
googlemock/test/gmock_leak_test_.cc
googlemock/test/gmock_leak_test_.cc
+1
-2
googlemock/test/gmock_link2_test.cc
googlemock/test/gmock_link2_test.cc
+1
-2
googlemock/test/gmock_link_test.cc
googlemock/test/gmock_link_test.cc
+1
-2
googlemock/test/gmock_link_test.h
googlemock/test/gmock_link_test.h
+1
-2
googlemock/test/gmock_output_test.py
googlemock/test/gmock_output_test.py
+3
-5
googlemock/test/gmock_output_test_.cc
googlemock/test/gmock_output_test_.cc
+1
-2
No files found.
googlemock/test/gmock-actions_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
@@ -88,10 +87,6 @@ using testing::tuple_element;
...
@@ -88,10 +87,6 @@ using testing::tuple_element;
using
testing
::
SetErrnoAndReturn
;
using
testing
::
SetErrnoAndReturn
;
#endif
#endif
#if GTEST_HAS_PROTOBUF_
using
testing
::
internal
::
TestMessage
;
#endif // GTEST_HAS_PROTOBUF_
// Tests that BuiltInDefaultValue<T*>::Get() returns NULL.
// Tests that BuiltInDefaultValue<T*>::Get() returns NULL.
TEST
(
BuiltInDefaultValueTest
,
IsNullForPointerTypes
)
{
TEST
(
BuiltInDefaultValueTest
,
IsNullForPointerTypes
)
{
EXPECT_TRUE
(
BuiltInDefaultValue
<
int
*>::
Get
()
==
NULL
);
EXPECT_TRUE
(
BuiltInDefaultValue
<
int
*>::
Get
()
==
NULL
);
...
@@ -895,105 +890,6 @@ TEST(SetArgPointeeTest, AcceptsWideCharPointer) {
...
@@ -895,105 +890,6 @@ TEST(SetArgPointeeTest, AcceptsWideCharPointer) {
# endif
# 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
// Tests that SetArgumentPointee<N>(v) sets the variable pointed to by
// the N-th (0-based) argument to v.
// the N-th (0-based) argument to v.
TEST
(
SetArgumentPointeeTest
,
SetsTheNthPointee
)
{
TEST
(
SetArgumentPointeeTest
,
SetsTheNthPointee
)
{
...
@@ -1014,105 +910,6 @@ TEST(SetArgumentPointeeTest, SetsTheNthPointee) {
...
@@ -1014,105 +910,6 @@ TEST(SetArgumentPointeeTest, SetsTheNthPointee) {
EXPECT_EQ
(
'a'
,
ch
);
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.
// Sample functions and functors for testing Invoke() and etc.
int
Nullary
()
{
return
1
;
}
int
Nullary
()
{
return
1
;
}
...
@@ -1546,7 +1343,7 @@ TEST(FunctorActionTest, UnusedArguments) {
...
@@ -1546,7 +1343,7 @@ TEST(FunctorActionTest, UnusedArguments) {
}
}
// Test that basic built-in actions work with move-only arguments.
// Test that basic built-in actions work with move-only arguments.
//
TODO(rburny)
: Currently, almost all ActionInterface-based actions will not
//
FIXME
: Currently, almost all ActionInterface-based actions will not
// work, even if they only try to use other, copyable arguments. Implement them
// work, even if they only try to use other, copyable arguments. Implement them
// if necessary (but note that DoAll cannot work on non-copyable types anyway -
// if necessary (but note that DoAll cannot work on non-copyable types anyway -
// so maybe it's better to make users use lambdas instead.
// so maybe it's better to make users use lambdas instead.
...
...
googlemock/test/gmock-cardinalities_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock-generated-actions_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock-generated-function-mockers_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock-generated-internal-utils_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock-internal-utils_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock-matchers_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
@@ -2680,7 +2679,7 @@ TEST(AllOfTest, ExplainsResult) {
...
@@ -2680,7 +2679,7 @@ TEST(AllOfTest, ExplainsResult) {
}
}
// Helper to allow easy testing of AnyOf matchers with num parameters.
// Helper to allow easy testing of AnyOf matchers with num parameters.
void
AnyOfMatches
(
int
num
,
const
Matcher
<
int
>&
m
)
{
static
void
AnyOfMatches
(
int
num
,
const
Matcher
<
int
>&
m
)
{
SCOPED_TRACE
(
Describe
(
m
));
SCOPED_TRACE
(
Describe
(
m
));
EXPECT_FALSE
(
m
.
Matches
(
0
));
EXPECT_FALSE
(
m
.
Matches
(
0
));
for
(
int
i
=
1
;
i
<=
num
;
++
i
)
{
for
(
int
i
=
1
;
i
<=
num
;
++
i
)
{
...
@@ -2689,6 +2688,18 @@ void AnyOfMatches(int num, const Matcher<int>& m) {
...
@@ -2689,6 +2688,18 @@ void AnyOfMatches(int num, const Matcher<int>& m) {
EXPECT_FALSE
(
m
.
Matches
(
num
+
1
));
EXPECT_FALSE
(
m
.
Matches
(
num
+
1
));
}
}
#if GTEST_LANG_CXX11
static
void
AnyOfStringMatches
(
int
num
,
const
Matcher
<
std
::
string
>&
m
)
{
SCOPED_TRACE
(
Describe
(
m
));
EXPECT_FALSE
(
m
.
Matches
(
std
::
to_string
(
0
)));
for
(
int
i
=
1
;
i
<=
num
;
++
i
)
{
EXPECT_TRUE
(
m
.
Matches
(
std
::
to_string
(
i
)));
}
EXPECT_FALSE
(
m
.
Matches
(
std
::
to_string
(
num
+
1
)));
}
#endif
// Tests that AnyOf(m1, ..., mn) matches any value that matches at
// Tests that AnyOf(m1, ..., mn) matches any value that matches at
// least one of the given matchers.
// least one of the given matchers.
TEST
(
AnyOfTest
,
MatchesWhenAnyMatches
)
{
TEST
(
AnyOfTest
,
MatchesWhenAnyMatches
)
{
...
@@ -2746,6 +2757,12 @@ TEST(AnyOfTest, VariadicMatchesWhenAnyMatches) {
...
@@ -2746,6 +2757,12 @@ TEST(AnyOfTest, VariadicMatchesWhenAnyMatches) {
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
,
46
,
47
,
48
,
49
,
50
));
41
,
42
,
43
,
44
,
45
,
46
,
47
,
48
,
49
,
50
));
AnyOfStringMatches
(
50
,
AnyOf
(
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
,
"27"
,
"28"
,
"29"
,
"30"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"38"
,
"39"
,
"40"
,
"41"
,
"42"
,
"43"
,
"44"
,
"45"
,
"46"
,
"47"
,
"48"
,
"49"
,
"50"
));
}
}
// Tests the variadic version of the ElementsAreMatcher
// Tests the variadic version of the ElementsAreMatcher
...
@@ -4220,13 +4237,17 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) {
...
@@ -4220,13 +4237,17 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) {
// ref-qualified.
// ref-qualified.
TEST
(
PropertyTest
,
WorksForRefQualifiedProperty
)
{
TEST
(
PropertyTest
,
WorksForRefQualifiedProperty
)
{
Matcher
<
const
AClass
&>
m
=
Property
(
&
AClass
::
s_ref
,
StartsWith
(
"hi"
));
Matcher
<
const
AClass
&>
m
=
Property
(
&
AClass
::
s_ref
,
StartsWith
(
"hi"
));
Matcher
<
const
AClass
&>
m_with_name
=
Property
(
"s"
,
&
AClass
::
s_ref
,
StartsWith
(
"hi"
));
AClass
a
;
AClass
a
;
a
.
set_s
(
"hill"
);
a
.
set_s
(
"hill"
);
EXPECT_TRUE
(
m
.
Matches
(
a
));
EXPECT_TRUE
(
m
.
Matches
(
a
));
EXPECT_TRUE
(
m_with_name
.
Matches
(
a
));
a
.
set_s
(
"hole"
);
a
.
set_s
(
"hole"
);
EXPECT_FALSE
(
m
.
Matches
(
a
));
EXPECT_FALSE
(
m
.
Matches
(
a
));
EXPECT_FALSE
(
m_with_name
.
Matches
(
a
));
}
}
#endif
#endif
...
@@ -4570,7 +4591,7 @@ TEST(ResultOfTest, WorksForFunctors) {
...
@@ -4570,7 +4591,7 @@ TEST(ResultOfTest, WorksForFunctors) {
}
}
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
// functor with more th
e
n one operator() defined. ResultOf() must work
// functor with more th
a
n one operator() defined. ResultOf() must work
// for each defined operator().
// for each defined operator().
struct
PolymorphicFunctor
{
struct
PolymorphicFunctor
{
typedef
int
result_type
;
typedef
int
result_type
;
...
@@ -6764,4 +6785,3 @@ TEST(NotTest, WorksOnMoveOnlyType) {
...
@@ -6764,4 +6785,3 @@ TEST(NotTest, WorksOnMoveOnlyType) {
}
// namespace gmock_matchers_test
}
// namespace gmock_matchers_test
}
// namespace testing
}
// namespace testing
googlemock/test/gmock-more-actions_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock-nice-strict_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
#include "gmock/gmock-generated-nice-strict.h"
#include "gmock/gmock-generated-nice-strict.h"
...
...
googlemock/test/gmock-port_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock-spec-builders_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
@@ -1176,7 +1175,7 @@ TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) {
...
@@ -1176,7 +1175,7 @@ TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) {
TEST
(
UndefinedReturnValueTest
,
TEST
(
UndefinedReturnValueTest
,
ReturnValueIsMandatoryWhenNotDefaultConstructible
)
{
ReturnValueIsMandatoryWhenNotDefaultConstructible
)
{
MockA
a
;
MockA
a
;
//
TODO(wan@google.com)
: We should really verify the output message,
//
FIXME
: We should really verify the output message,
// but we cannot yet due to that EXPECT_DEATH only captures stderr
// but we cannot yet due to that EXPECT_DEATH only captures stderr
// while Google Mock logs to stdout.
// while Google Mock logs to stdout.
#if GTEST_HAS_EXCEPTIONS
#if GTEST_HAS_EXCEPTIONS
...
...
googlemock/test/gmock_all_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
//
//
// Tests for Google C++ Mocking Framework (Google Mock)
// Tests for Google C++ Mocking Framework (Google Mock)
//
//
...
...
googlemock/test/gmock_ex_test.cc
View file @
a9bd428e
...
@@ -26,17 +26,18 @@
...
@@ -26,17 +26,18 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Tests Google Mock's functionality that depends on exceptions.
// Tests Google Mock's functionality that depends on exceptions.
#include "gmock/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#if GTEST_HAS_EXCEPTIONS
namespace
{
namespace
{
using
testing
::
HasSubstr
;
using
testing
::
HasSubstr
;
using
testing
::
internal
::
GoogleTestFailureException
;
using
testing
::
internal
::
GoogleTestFailureException
;
// A type that cannot be default constructed.
// A type that cannot be default constructed.
...
@@ -52,8 +53,6 @@ class MockFoo {
...
@@ -52,8 +53,6 @@ class MockFoo {
MOCK_METHOD0
(
GetNonDefaultConstructible
,
NonDefaultConstructible
());
MOCK_METHOD0
(
GetNonDefaultConstructible
,
NonDefaultConstructible
());
};
};
#if GTEST_HAS_EXCEPTIONS
TEST
(
DefaultValueTest
,
ThrowsRuntimeErrorWhenNoDefaultValue
)
{
TEST
(
DefaultValueTest
,
ThrowsRuntimeErrorWhenNoDefaultValue
)
{
MockFoo
mock
;
MockFoo
mock
;
try
{
try
{
...
@@ -76,6 +75,6 @@ TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) {
...
@@ -76,6 +75,6 @@ TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) {
}
}
}
}
#endif
}
// unnamed namespace
}
// unnamed namespace
#endif
googlemock/test/gmock_leak_test.py
View file @
a9bd428e
...
@@ -31,12 +31,8 @@
...
@@ -31,12 +31,8 @@
"""Tests that leaked mock objects can be caught be Google Mock."""
"""Tests that leaked mock objects can be caught be Google Mock."""
__author__
=
'wan@google.com (Zhanyong Wan)'
import
gmock_test_utils
import
gmock_test_utils
PROGRAM_PATH
=
gmock_test_utils
.
GetTestExecutablePath
(
'gmock_leak_test_'
)
PROGRAM_PATH
=
gmock_test_utils
.
GetTestExecutablePath
(
'gmock_leak_test_'
)
TEST_WITH_EXPECT_CALL
=
[
PROGRAM_PATH
,
'--gtest_filter=*ExpectCall*'
]
TEST_WITH_EXPECT_CALL
=
[
PROGRAM_PATH
,
'--gtest_filter=*ExpectCall*'
]
TEST_WITH_ON_CALL
=
[
PROGRAM_PATH
,
'--gtest_filter=*OnCall*'
]
TEST_WITH_ON_CALL
=
[
PROGRAM_PATH
,
'--gtest_filter=*OnCall*'
]
...
...
googlemock/test/gmock_leak_test_.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock_link2_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock_link_test.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock_link_test.h
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
// Google Mock - a framework for writing C++ mock classes.
// Google Mock - a framework for writing C++ mock classes.
//
//
...
...
googlemock/test/gmock_output_test.py
View file @
a9bd428e
...
@@ -29,21 +29,19 @@
...
@@ -29,21 +29,19 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Tests the text output of Google C++ Mocking Framework.
r
"""Tests the text output of Google C++ Mocking Framework.
To update the golden file:
To update the golden file:
gmock_output_test.py --build_dir=BUILD/DIR --gengolden
gmock_output_test.py --build_dir=BUILD/DIR --gengolden
#
where BUILD/DIR contains the built gmock_output_test_ file.
where BUILD/DIR contains the built gmock_output_test_ file.
gmock_output_test.py --gengolden
gmock_output_test.py --gengolden
gmock_output_test.py
gmock_output_test.py
"""
__author__
=
'wan@google.com (Zhanyong Wan)'
"""
import
os
import
os
import
re
import
re
import
sys
import
sys
import
gmock_test_utils
import
gmock_test_utils
...
...
googlemock/test/gmock_output_test_.cc
View file @
a9bd428e
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Tests Google Mock's output in various scenarios. This ensures that
// Tests Google Mock's output in various scenarios. This ensures that
// Google Mock's messages are readable and useful.
// Google Mock's messages are readable and useful.
...
...
Prev
1
2
3
4
5
6
7
…
11
Next
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