Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
a79851f2
Commit
a79851f2
authored
Apr 12, 2018
by
Gennadiy Civil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merging
parent
3ccd6e38
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
3 deletions
+67
-3
gmock-generated-nice-strict.h
googlemock/include/gmock/gmock-generated-nice-strict.h
+15
-0
gmock-generated-nice-strict.h.pump
googlemock/include/gmock/gmock-generated-nice-strict.h.pump
+5
-0
gmock-nice-strict_test.cc
googlemock/test/gmock-nice-strict_test.cc
+47
-3
No files found.
googlemock/include/gmock/gmock-generated-nice-strict.h
View file @
a79851f2
...
@@ -80,6 +80,11 @@ class NiceMock : public MockClass {
...
@@ -80,6 +80,11 @@ class NiceMock : public MockClass {
}
}
#if GTEST_LANG_CXX11
#if GTEST_LANG_CXX11
// Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// Single argument constructor is special-cased so that it can be
// made explicit.
// made explicit.
template
<
typename
A
>
template
<
typename
A
>
...
@@ -193,6 +198,11 @@ class NaggyMock : public MockClass {
...
@@ -193,6 +198,11 @@ class NaggyMock : public MockClass {
}
}
#if GTEST_LANG_CXX11
#if GTEST_LANG_CXX11
// Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// Single argument constructor is special-cased so that it can be
// made explicit.
// made explicit.
template
<
typename
A
>
template
<
typename
A
>
...
@@ -306,6 +316,11 @@ class StrictMock : public MockClass {
...
@@ -306,6 +316,11 @@ class StrictMock : public MockClass {
}
}
#if GTEST_LANG_CXX11
#if GTEST_LANG_CXX11
// Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// Single argument constructor is special-cased so that it can be
// made explicit.
// made explicit.
template
<
typename
A
>
template
<
typename
A
>
...
...
googlemock/include/gmock/gmock-generated-nice-strict.h.pump
View file @
a79851f2
...
@@ -92,6 +92,11 @@ class $clazz : public MockClass {
...
@@ -92,6 +92,11 @@ class $clazz : public MockClass {
}
}
#if GTEST_LANG_CXX11
#if GTEST_LANG_CXX11
// Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// Single argument constructor is special-cased so that it can be
// made explicit.
// made explicit.
template
<
typename
A
>
template
<
typename
A
>
...
...
googlemock/test/gmock-nice-strict_test.cc
View file @
a79851f2
...
@@ -32,9 +32,10 @@
...
@@ -32,9 +32,10 @@
#include "gmock/gmock-generated-nice-strict.h"
#include "gmock/gmock-generated-nice-strict.h"
#include <string>
#include <string>
#include <utility>
#include "gmock/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "gtest/gtest-spi.h"
#include "gtest/gtest-spi.h"
#include "gtest/gtest.h"
// This must not be defined inside the ::testing namespace, or it will
// This must not be defined inside the ::testing namespace, or it will
// clash with ::testing::Mock.
// clash with ::testing::Mock.
...
@@ -114,6 +115,24 @@ class MockBar {
...
@@ -114,6 +115,24 @@ class MockBar {
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
MockBar
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
MockBar
);
};
};
#if GTEST_GTEST_LANG_CXX11
class
MockBaz
{
public
:
class
MoveOnly
{
MoveOnly
()
=
default
;
MoveOnly
(
const
MoveOnly
&
)
=
delete
;
operator
=
(
const
MoveOnly
&
)
=
delete
;
MoveOnly
(
MoveOnly
&&
)
=
default
;
operator
=
(
MoveOnly
&&
)
=
default
;
};
MockBaz
(
MoveOnly
)
{}
}
#endif // GTEST_GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
#if GTEST_HAS_STREAM_REDIRECTION
#if GTEST_HAS_STREAM_REDIRECTION
// Tests that a raw mock generates warnings for uninteresting calls.
// Tests that a raw mock generates warnings for uninteresting calls.
...
@@ -214,8 +233,9 @@ TEST(NiceMockTest, AllowsExpectedCall) {
...
@@ -214,8 +233,9 @@ TEST(NiceMockTest, AllowsExpectedCall) {
nice_foo
.
DoThis
();
nice_foo
.
DoThis
();
}
}
// Tests that an unexpected call on a nice mock which returns a not-default-constructible
// Tests that an unexpected call on a nice mock which returns a
// type throws an exception and the exception contains the method's name.
// not-default-constructible type throws an exception and the exception contains
// the method's name.
TEST
(
NiceMockTest
,
ThrowsExceptionForUnknownReturnTypes
)
{
TEST
(
NiceMockTest
,
ThrowsExceptionForUnknownReturnTypes
)
{
NiceMock
<
MockFoo
>
nice_foo
;
NiceMock
<
MockFoo
>
nice_foo
;
#if GTEST_HAS_EXCEPTIONS
#if GTEST_HAS_EXCEPTIONS
...
@@ -266,6 +286,14 @@ TEST(NiceMockTest, AllowLeak) {
...
@@ -266,6 +286,14 @@ TEST(NiceMockTest, AllowLeak) {
leaked
->
DoThis
();
leaked
->
DoThis
();
}
}
#if GTEST_GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
TEST
(
NiceMockTest
,
MoveOnlyConstructor
)
{
NiceMock
<
MockBaz
>
nice_baz
(
MockBaz
::
MoveOnly
());
}
#endif // GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
// Tests that NiceMock<Mock> compiles where Mock is a user-defined
// Tests that NiceMock<Mock> compiles where Mock is a user-defined
// class (as opposed to ::testing::Mock). We had to work around an
// class (as opposed to ::testing::Mock). We had to work around an
...
@@ -366,6 +394,14 @@ TEST(NaggyMockTest, AllowLeak) {
...
@@ -366,6 +394,14 @@ TEST(NaggyMockTest, AllowLeak) {
leaked
->
DoThis
();
leaked
->
DoThis
();
}
}
#if GTEST_GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
TEST
(
NaggyMockTest
,
MoveOnlyConstructor
)
{
NaggyMock
<
MockBaz
>
naggy_baz
(
MockBaz
::
MoveOnly
());
}
#endif // GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
// Tests that NaggyMock<Mock> compiles where Mock is a user-defined
// Tests that NaggyMock<Mock> compiles where Mock is a user-defined
// class (as opposed to ::testing::Mock). We had to work around an
// class (as opposed to ::testing::Mock). We had to work around an
...
@@ -447,6 +483,14 @@ TEST(StrictMockTest, AllowLeak) {
...
@@ -447,6 +483,14 @@ TEST(StrictMockTest, AllowLeak) {
leaked
->
DoThis
();
leaked
->
DoThis
();
}
}
#if GTEST_GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
TEST
(
StrictMockTest
,
MoveOnlyConstructor
)
{
StrictMock
<
MockBaz
>
strict_baz
(
MockBaz
::
MoveOnly
());
}
#endif // GTEST_LANG_CXX11 && GTEST_HAS_STD_MOVE_
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
#if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
// Tests that StrictMock<Mock> compiles where Mock is a user-defined
// Tests that StrictMock<Mock> compiles where Mock is a user-defined
// class (as opposed to ::testing::Mock). We had to work around an
// class (as opposed to ::testing::Mock). We had to work around an
...
...
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