diff options
author | Gennadiy Civil <misterg@google.com> | 2018-04-18 14:36:12 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-04-18 14:36:12 (GMT) |
commit | 4707c0ffd4385e7195170a427e4a0471bb5335a6 (patch) | |
tree | 26b35dc506e533dd74abfb53b6090c8acd743ad4 /googlemock | |
parent | 80d6e26a9c170812614f2e29c53f0893446d8cee (diff) | |
download | googletest-4707c0ffd4385e7195170a427e4a0471bb5335a6.zip googletest-4707c0ffd4385e7195170a427e4a0471bb5335a6.tar.gz googletest-4707c0ffd4385e7195170a427e4a0471bb5335a6.tar.bz2 |
193353312
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 11 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 9 |
2 files changed, 16 insertions, 4 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 7c70775..3a2b944 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -5212,17 +5212,20 @@ internal::AnyOfMatcher<Args...> AnyOf(const Args&... matchers) { } template <typename... Args> -internal::ElementsAreMatcher<tuple<typename std::decay<Args>::type...>> +internal::ElementsAreMatcher<tuple<typename std::decay<const Args&>::type...>> ElementsAre(const Args&... matchers) { return internal::ElementsAreMatcher< - tuple<typename std::decay<Args>::type...>>(make_tuple(matchers...)); + tuple<typename std::decay<const Args&>::type...>>( + make_tuple(matchers...)); } template <typename... Args> -internal::UnorderedElementsAreMatcher<tuple<typename std::decay<Args>::type...>> +internal::UnorderedElementsAreMatcher< + tuple<typename std::decay<const Args&>::type...>> UnorderedElementsAre(const Args&... matchers) { return internal::UnorderedElementsAreMatcher< - tuple<typename std::decay<Args>::type...>>(make_tuple(matchers...)); + tuple<typename std::decay<const Args&>::type...>>( + make_tuple(matchers...)); } #endif // GTEST_LANG_CXX11 diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index c40944b..8b115cd 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -2752,6 +2752,15 @@ TEST(ElementsAreTest, HugeMatcher) { } // Tests the variadic version of the UnorderedElementsAreMatcher +TEST(ElementsAreTest, HugeMatcherStr) { + vector<string> test_vector{ + "literal_string", "", "", "", "", "", "", "", "", "", "", ""}; + + EXPECT_THAT(test_vector, UnorderedElementsAre("literal_string", _, _, _, _, _, + _, _, _, _, _, _)); +} + +// Tests the variadic version of the UnorderedElementsAreMatcher TEST(ElementsAreTest, HugeMatcherUnordered) { vector<int> test_vector{2, 1, 8, 5, 4, 6, 7, 3, 9, 12, 11, 10}; |