summaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock-actions_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-05-14 16:00:56 (GMT)
committerDerek Mauro <dmauro@google.com>2020-05-28 23:53:26 (GMT)
commit63713e1ce49019da205daa1ca91b73fcfc9b333f (patch)
tree624e49e4868589aa4b0936d673ec828b8302f078 /googlemock/test/gmock-actions_test.cc
parent011959aafddcd30611003de96cfd8d7a7685c700 (diff)
downloadgoogletest-63713e1ce49019da205daa1ca91b73fcfc9b333f.zip
googletest-63713e1ce49019da205daa1ca91b73fcfc9b333f.tar.gz
googletest-63713e1ce49019da205daa1ca91b73fcfc9b333f.tar.bz2
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
Diffstat (limited to 'googlemock/test/gmock-actions_test.cc')
-rw-r--r--googlemock/test/gmock-actions_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc
index cac8f94..547f48f 100644
--- a/googlemock/test/gmock-actions_test.cc
+++ b/googlemock/test/gmock-actions_test.cc
@@ -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