Source release 19.5.0
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest-spi.h"
|
||||
#include "gtest/gtest.h"
|
||||
@@ -39,12 +40,13 @@
|
||||
// clash with ::testing::Mock.
|
||||
class Mock {
|
||||
public:
|
||||
Mock() {}
|
||||
Mock() = default;
|
||||
|
||||
MOCK_METHOD0(DoThis, void());
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(Mock);
|
||||
Mock(const Mock&) = delete;
|
||||
Mock& operator=(const Mock&) = delete;
|
||||
};
|
||||
|
||||
namespace testing {
|
||||
@@ -76,7 +78,7 @@ class CallsMockMethodInDestructor {
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
virtual ~Foo() {}
|
||||
virtual ~Foo() = default;
|
||||
|
||||
virtual void DoThis() = 0;
|
||||
virtual int DoThat(bool flag) = 0;
|
||||
@@ -84,7 +86,7 @@ class Foo {
|
||||
|
||||
class MockFoo : public Foo {
|
||||
public:
|
||||
MockFoo() {}
|
||||
MockFoo() = default;
|
||||
void Delete() { delete this; }
|
||||
|
||||
MOCK_METHOD0(DoThis, void());
|
||||
@@ -92,7 +94,8 @@ class MockFoo : public Foo {
|
||||
MOCK_METHOD0(ReturnNonDefaultConstructible, NotDefaultConstructible());
|
||||
|
||||
private:
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
|
||||
MockFoo(const MockFoo&) = delete;
|
||||
MockFoo& operator=(const MockFoo&) = delete;
|
||||
};
|
||||
|
||||
class MockBar {
|
||||
@@ -102,10 +105,11 @@ class MockBar {
|
||||
MockBar(char a1, char a2, std::string a3, std::string a4, int a5, int a6,
|
||||
const std::string& a7, const std::string& a8, bool a9, bool a10) {
|
||||
str_ = std::string() + a1 + a2 + a3 + a4 + static_cast<char>(a5) +
|
||||
static_cast<char>(a6) + a7 + a8 + (a9 ? 'T' : 'F') + (a10 ? 'T' : 'F');
|
||||
static_cast<char>(a6) + a7 + a8 + (a9 ? 'T' : 'F') +
|
||||
(a10 ? 'T' : 'F');
|
||||
}
|
||||
|
||||
virtual ~MockBar() {}
|
||||
virtual ~MockBar() = default;
|
||||
|
||||
const std::string& str() const { return str_; }
|
||||
|
||||
@@ -115,10 +119,10 @@ class MockBar {
|
||||
private:
|
||||
std::string str_;
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockBar);
|
||||
MockBar(const MockBar&) = delete;
|
||||
MockBar& operator=(const MockBar&) = delete;
|
||||
};
|
||||
|
||||
|
||||
class MockBaz {
|
||||
public:
|
||||
class MoveOnly {
|
||||
@@ -161,8 +165,7 @@ TEST(RawMockTest, WarningForUninterestingCallAfterDeath) {
|
||||
|
||||
MockFoo* const raw_foo = new MockFoo;
|
||||
|
||||
ON_CALL(*raw_foo, DoThis())
|
||||
.WillByDefault(Invoke(raw_foo, &MockFoo::Delete));
|
||||
ON_CALL(*raw_foo, DoThis()).WillByDefault(Invoke(raw_foo, &MockFoo::Delete));
|
||||
|
||||
CaptureStdout();
|
||||
raw_foo->DoThis();
|
||||
@@ -280,8 +283,8 @@ TEST(NiceMockTest, NonDefaultConstructor) {
|
||||
// Tests that NiceMock works with a mock class that has a 10-ary
|
||||
// non-default constructor.
|
||||
TEST(NiceMockTest, NonDefaultConstructor10) {
|
||||
NiceMock<MockBar> nice_bar('a', 'b', "c", "d", 'e', 'f',
|
||||
"g", "h", true, false);
|
||||
NiceMock<MockBar> nice_bar('a', 'b', "c", "d", 'e', 'f', "g", "h", true,
|
||||
false);
|
||||
EXPECT_EQ("abcdefghTF", nice_bar.str());
|
||||
|
||||
nice_bar.This();
|
||||
@@ -390,8 +393,8 @@ TEST(NaggyMockTest, NonDefaultConstructor) {
|
||||
// Tests that NaggyMock works with a mock class that has a 10-ary
|
||||
// non-default constructor.
|
||||
TEST(NaggyMockTest, NonDefaultConstructor10) {
|
||||
NaggyMock<MockBar> naggy_bar('0', '1', "2", "3", '4', '5',
|
||||
"6", "7", true, false);
|
||||
NaggyMock<MockBar> naggy_bar('0', '1', "2", "3", '4', '5', "6", "7", true,
|
||||
false);
|
||||
EXPECT_EQ("01234567TF", naggy_bar.str());
|
||||
|
||||
naggy_bar.This();
|
||||
@@ -490,8 +493,8 @@ TEST(StrictMockTest, NonDefaultConstructor) {
|
||||
// Tests that StrictMock works with a mock class that has a 10-ary
|
||||
// non-default constructor.
|
||||
TEST(StrictMockTest, NonDefaultConstructor10) {
|
||||
StrictMock<MockBar> strict_bar('a', 'b', "c", "d", 'e', 'f',
|
||||
"g", "h", true, false);
|
||||
StrictMock<MockBar> strict_bar('a', 'b', "c", "d", 'e', 'f', "g", "h", true,
|
||||
false);
|
||||
EXPECT_EQ("abcdefghTF", strict_bar.str());
|
||||
|
||||
EXPECT_NONFATAL_FAILURE(strict_bar.That(5, true),
|
||||
|
||||
Reference in New Issue
Block a user