Googletest export

Fix DoAll to work with move-only sink arguments.

This changes types of the first n - 1 actions so that they only get a readonly
view of the arguments. The last action will accept move only objects.

PiperOrigin-RevId: 324619666
This commit is contained in:
Abseil Team
2020-08-03 12:33:44 -04:00
committed by Derek Mauro
parent 48ec64092a
commit 5a5caab358
3 changed files with 7 additions and 21 deletions

View File

@@ -422,15 +422,6 @@ TEST(DoAllTest, TenActions) {
EXPECT_EQ('g', g);
}
TEST(DoAllTest, MoveOnlyArgs) {
bool ran_first = false;
Action<int(std::unique_ptr<int>)> a =
DoAll(InvokeWithoutArgs([&] { ran_first = true; }),
[](std::unique_ptr<int> p) { return *p; });
EXPECT_EQ(7, a.Perform(std::make_tuple(std::unique_ptr<int>(new int(7)))));
EXPECT_TRUE(ran_first);
}
// The ACTION*() macros trigger warning C4100 (unreferenced formal
// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
// the macro definition, as the warnings are generated when the macro