Googletest export
Fix the ACTION* macros to allow for more than 10 arguments in the action. Only the first 10 will be passed as individual arguments as `argN`, but the rest can be accessed from the `args` tuple. PiperOrigin-RevId: 311542098
This commit is contained in:
@@ -1550,6 +1550,26 @@ TEST(MoveOnlyArgumentsTest, ReturningActions) {
|
||||
EXPECT_EQ(x, 3);
|
||||
}
|
||||
|
||||
ACTION(ReturnArity) {
|
||||
return std::tuple_size<args_type>::value;
|
||||
}
|
||||
|
||||
TEST(ActionMacro, LargeArity) {
|
||||
EXPECT_EQ(
|
||||
1, testing::Action<int(int)>(ReturnArity()).Perform(std::make_tuple(0)));
|
||||
EXPECT_EQ(
|
||||
10,
|
||||
testing::Action<int(int, int, int, int, int, int, int, int, int, int)>(
|
||||
ReturnArity())
|
||||
.Perform(std::make_tuple(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)));
|
||||
EXPECT_EQ(
|
||||
20,
|
||||
testing::Action<int(int, int, int, int, int, int, int, int, int, int, int,
|
||||
int, int, int, int, int, int, int, int, int)>(
|
||||
ReturnArity())
|
||||
.Perform(std::make_tuple(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
|
||||
14, 15, 16, 17, 18, 19)));
|
||||
}
|
||||
|
||||
} // Unnamed namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user