gmock-actions: add a missing conversion operator to WithArgsAction.
PiperOrigin-RevId: 745802500 Change-Id: I8cf7b69f89af8615e9c405b1e6552d3e12ebf93d
This commit is contained in:
committed by
Copybara-Service
parent
50a9511f50
commit
e90fe24856
@@ -1645,6 +1645,22 @@ TEST(WithArgsTest, RefQualifiedInnerAction) {
|
||||
EXPECT_EQ(19, mock.AsStdFunction()(0, 17));
|
||||
}
|
||||
|
||||
// It should be fine to provide an lvalue WithArgsAction to WillOnce, even when
|
||||
// the inner action only wants to convert to OnceAction.
|
||||
TEST(WithArgsTest, ProvideAsLvalueToWillOnce) {
|
||||
struct SomeAction {
|
||||
operator OnceAction<int(int)>() const { // NOLINT
|
||||
return [](const int arg) { return arg + 2; };
|
||||
}
|
||||
};
|
||||
|
||||
const auto wa = WithArg<1>(SomeAction{});
|
||||
|
||||
MockFunction<int(int, int)> mock;
|
||||
EXPECT_CALL(mock, Call).WillOnce(wa);
|
||||
EXPECT_EQ(19, mock.AsStdFunction()(0, 17));
|
||||
}
|
||||
|
||||
#ifndef GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
class SetErrnoAndReturnTest : public testing::Test {
|
||||
|
||||
Reference in New Issue
Block a user