Removes the .WithArguments() clause from ON_CALL and EXPECT_CALL.
This commit is contained in:
parent
07587e9db4
commit
4cd148e588
@ -163,14 +163,6 @@ class DefaultActionSpec {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements the .WithArguments() clause as a synonym of .With()
|
|
||||||
// for backward compatibility. WithArguments() is deprecated and
|
|
||||||
// new code should always use With(), as .With(Args<1, 2>(m)) is
|
|
||||||
// clearer than .WithArguments(Args<1, 2>(m)).
|
|
||||||
DefaultActionSpec& WithArguments(const Matcher<const ArgumentTuple&>& m) {
|
|
||||||
return With(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implements the .WillByDefault() clause.
|
// Implements the .WillByDefault() clause.
|
||||||
DefaultActionSpec& WillByDefault(const Action<F>& action) {
|
DefaultActionSpec& WillByDefault(const Action<F>& action) {
|
||||||
ExpectSpecProperty(last_clause_ < kWillByDefault,
|
ExpectSpecProperty(last_clause_ < kWillByDefault,
|
||||||
@ -615,12 +607,6 @@ class Expectation : public ExpectationBase {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements the .WithArguments() clause as a synonym of .With().
|
|
||||||
// This is deprecated and new code should always use With().
|
|
||||||
Expectation& WithArguments(const Matcher<const ArgumentTuple&>& m) {
|
|
||||||
return With(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implements the .Times() clause.
|
// Implements the .Times() clause.
|
||||||
Expectation& Times(const Cardinality& cardinality) {
|
Expectation& Times(const Cardinality& cardinality) {
|
||||||
if (last_clause_ ==kTimes) {
|
if (last_clause_ ==kTimes) {
|
||||||
|
@ -194,21 +194,6 @@ TEST(OnCallSyntaxTest, WithCanAppearAtMostOnce) {
|
|||||||
}, ".With() cannot appear more than once in an ON_CALL()");
|
}, ".With() cannot appear more than once in an ON_CALL()");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(OnCallSyntaxTest, WithArgumentsIsSynonymOfWith) {
|
|
||||||
MockA a;
|
|
||||||
ON_CALL(a, ReturnInt(_, _))
|
|
||||||
.WithArguments(Lt())
|
|
||||||
.WillByDefault(Return(1));
|
|
||||||
ON_CALL(a, ReturnInt(_, _))
|
|
||||||
.WithArguments(Gt())
|
|
||||||
.WillByDefault(Return(2));
|
|
||||||
EXPECT_CALL(a, ReturnInt(_, _))
|
|
||||||
.Times(AnyNumber());
|
|
||||||
|
|
||||||
EXPECT_EQ(1, a.ReturnInt(1, 2));
|
|
||||||
EXPECT_EQ(2, a.ReturnInt(2, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#if GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
TEST(OnCallSyntaxTest, WillByDefaultIsMandatory) {
|
TEST(OnCallSyntaxTest, WillByDefaultIsMandatory) {
|
||||||
@ -296,19 +281,6 @@ TEST(ExpectCallSyntaxTest, WithMustBeFirstClause) {
|
|||||||
a.DoA(2);
|
a.DoA(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ExpectCallSyntaxTest, WithArgumentsIsSynonymOfWith) {
|
|
||||||
MockA a;
|
|
||||||
EXPECT_CALL(a, ReturnInt(_, _))
|
|
||||||
.WithArguments(Lt())
|
|
||||||
.WillOnce(Return(1));
|
|
||||||
EXPECT_CALL(a, ReturnInt(_, _))
|
|
||||||
.WithArguments(Gt())
|
|
||||||
.WillOnce(Return(2));
|
|
||||||
|
|
||||||
EXPECT_EQ(1, a.ReturnInt(1, 2));
|
|
||||||
EXPECT_EQ(2, a.ReturnInt(2, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(ExpectCallSyntaxTest, TimesCanBeInferred) {
|
TEST(ExpectCallSyntaxTest, TimesCanBeInferred) {
|
||||||
MockA a;
|
MockA a;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user