aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-matchers.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2815 from Quuxplusone:simpleGennadiy Rozental2020-05-011-98/+3
|\ | | | | | | PiperOrigin-RevId: 308625388
| * Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_.Arthur O'Dwyer2020-04-231-96/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | None of these are strictly needed for correctness. A large number of them (maybe all of them?) trigger `-Wdeprecated` warnings on Clang trunk as soon as you try to use the implicitly defaulted (but deprecated) copy constructor of a class that has deleted its copy assignment operator. By declaring a deleted copy assignment operator, the old code also caused the move constructor and move assignment operator to be non-declared. This means that the old code never got move semantics -- "move-construction" would simply call the defaulted (but deprecated) copy constructor instead. With the new code, "move-construction" calls the defaulted move constructor, which I believe is what we want to happen. So this is a runtime performance optimization. Unfortunately we can't yet physically remove the definitions of these macros from gtest-port.h, because they are being used by other code internally at Google (according to zhangxy988). But no new uses should be added going forward.
| * VariadicMatcher needs a non-defaulted move constructor for compile-time ↵Arthur O'Dwyer2020-04-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | performance. We are about to remove all uses of GTEST_DISALLOW_ASSIGN_ in favor of using the Rule of Zero everywhere. Unfortunately, if we use the Rule of Zero here, then when the compiler needs to figure out if VariadicMatcher is move-constructible, it will recurse down into `tuple<Args...>`, which on libstdc++ recurses too deeply. In file included from googlemock/test/gmock-matchers_test.cc:43: In file included from googlemock/include/gmock/gmock-matchers.h:258: In file included from /usr/include/c++/5.5.0/algorithm:60: In file included from /usr/include/c++/5.5.0/utility:70: In file included from /usr/include/c++/5.5.0/bits/stl_pair.h:59: In file included from /usr/include/c++/5.5.0/bits/move.h:57: /usr/bin/include/c++/5.5.0/type_traits:115:26: fatal error: recursive template instantiation exceeded maximum depth of 256 : public conditional<_B1::value, _B1, _B2>::type ^ The move constructor is the only problematic case, for some unknown reason. With GTEST_DISALLOW_ASSIGN_, the presence of a copy assignment operator causes the move constructor to be non-declared, thus non-defaulted, thus non-problematic. Without GTEST_DISALLOW_ASSIGN_, we have to do one of the following: - Default the copy constructor, so that the move constructor will be non-declared. - Define our own non-defaulted move constructor. ...except that doing the latter STILL did not work! Fortunately, the former (default the copy constructor, don't provide any move constructor) both works in practice and is semantically equivalent to the old code.
* | Googletest exportAbseil Team2020-05-011-1/+1
|/ | | | | | Fix comment that describes how to test against nullopt. PiperOrigin-RevId: 307448375
* Googletest exportAbseil Team2020-02-281-3/+10
| | | | | | | Relax the implementation of MatcherCast to allow conversion of `Matcher<T>` to `Matcher<const T&>`. They have the same match signature. PiperOrigin-RevId: 297115843
* Googletest exportAbseil Team2020-02-111-20/+20
| | | | | | Add gmock Matcher<std::string_view> specialization. PiperOrigin-RevId: 294443240
* Googletest exportAbseil Team2020-02-071-15/+141
| | | | | | | | Get rid of gmock-generated-matchers.h and gmock-generated-matchers.h.pump. Stop using pump for MATCHER* macroses generation. PiperOrigin-RevId: 293878808
* Googletest exportAbseil Team2020-02-071-2/+4
| | | | | | Fix std::move to std::forward where appropriate to support reference types. PiperOrigin-RevId: 292923058
* Googletest exportAbseil Team2020-02-071-19/+9
| | | | | | | Fix use of reserved names. Minimize code duplication needed for explict-vs-nonexplicit constructor. PiperOrigin-RevId: 292555014
* Googletest exportAbseil Team2020-02-071-1/+239
| | | | | | | | | | | Create implementation macroses for matchers to move variadic parameters to the end of parameters list. To save backward compatibility, old macroses will be still taking `description` parameter as the last one. But they will use INTERNAL macro that takes `description` as the second parameter. PiperOrigin-RevId: 291724469
* Googletest exportAbseil Team2020-02-071-0/+52
| | | | | | | | Move part of functionality of Matcher* class to the base one. Reduce copypaste. Make constructor and conversion operator of Matcher* class independent of pump. PiperOrigin-RevId: 291405510
* Googletest exportAbseil Team2020-01-211-1/+1
| | | | | | | | | Allow copying of the string in MatchAndExplain. Otherwise, conversions from std::string_view to std::string will fail as being explicit PiperOrigin-RevId: 290301103
* Googletest exportAbseil Team2020-01-021-0/+2
| | | | | | | | | | Explicitly default copy constructor in BoundSecondMatcher Since C++11, implicit defaulting of copy constructors is deprecated for types with user-defined copy assignment operators, so we should explicitly default the copy constructor of BoundSecondMatcher. PiperOrigin-RevId: 287587847
* Merge pull request #2594 from ↵Mark Barolak2019-12-051-17/+4
|\ | | | | | | | | | | kuzkry:remove-workaround_msvc-unneeded-const-dropping PiperOrigin-RevId: 283979494
| * remove MSVC workaround: cease const droppingKrystian Kuzniarek2019-11-221-14/+3
| |
* | Merge pull request #2597 from ↵Gennadiy Rozental2019-11-261-49/+36
|\ \ | | | | | | | | | | | | | | | kuzkry:remove-workaround_Nokia-Sybian-SafeMatcherCastImpl PiperOrigin-RevId: 282581402
| * | remove Nokia's Symbian compiler workaround: SafeMatcherCastImplKrystian Kuzniarek2019-11-221-49/+36
| | |
| * | consistency fix for SafeMatcherCastImpl member functionsKrystian Kuzniarek2019-11-221-1/+1
| |/
* / fix a typoKrystian Kuzniarek2019-11-021-1/+1
|/
* Googletest exportAbseil Team2019-10-311-2/+1
| | | | | | Tolerate std::string's explicit copy construction from std::string_view. PiperOrigin-RevId: 277583394
* Googletest exportAbseil Team2019-10-291-1/+3
| | | | | | | | Avoid temporary matcher instances. They are unnecessary and can be relatively more expensive than the rest of the algorithm. PiperOrigin-RevId: 277084853
* Googletest exportAbseil Team2019-10-221-1/+1
| | | | | | | | Remove bool_constant in favor of std::integral_constant<bool, ...>; The one non-trivial use of bool_constant has been changed to have significantly fewer template specializations. PiperOrigin-RevId: 275842490
* Googletest exportAbseil Team2019-10-221-2/+24
| | | | | | Rolling forward IsNan() matcher with fixes in test for -Wconversion issues. Use std::nanf and std::nanl where appropriate. PiperOrigin-RevId: 275523003
* Googletest exportmisterg2019-10-181-24/+2
| | | | | | Added IsNan matcher PiperOrigin-RevId: 275473218
* Googletest exportAbseil Team2019-10-171-2/+24
| | | | | | Added IsNan matcher PiperOrigin-RevId: 275278634
* Merge pull request #2448 from kuzkry:bad-googletest-exportGennadiy Civil2019-10-101-2/+2
|\ | | | | | | PiperOrigin-RevId: 273585026
| * square away the stuff that hasn't been merged in a manual reviewKrystian Kuzniarek2019-09-161-2/+2
| | | | | | | | | | This fixes up ab8f346b (a manual merge) that has abandoned some things from PR #2395.
* | Googletest exportAbseil Team2019-09-271-2/+4
|/ | | | | | Makes testing::ResultOf() work with non-copyable arguments. PiperOrigin-RevId: 271222632
* Googletest exportkuzkry2019-09-161-12/+12
| | | | | | | | | Merge 3bdefdb473d304803d2a38e2a2cd5cdc1827c3bd into fb49e6c164490a227bbb7cf5223b846c836a0305 Closes #2407 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/googletest/pull/2407 from kuzkry:StaticAssertTypeEq 3bdefdb473d304803d2a38e2a2cd5cdc1827c3bd PiperOrigin-RevId: 269255328
* Merge pull request #2387 from kuzkry:iffShaindel Schwartz2019-09-121-20/+20
|\ | | | | | | PiperOrigin-RevId: 268693457
| * restore mistakenly removed iffs in their explicit formKrystian Kuzniarek2019-08-201-20/+20
| | | | | | | | | | Due to confusion arisen from "iff" standing for "if and only if", this commit uses the latter.
* | Googletest exportkuzkry2019-09-061-3/+2
| | | | | | | | | | | | | | | | | | Merge 7f4f58da20e1066a888d3e4bcbef541db798a605 into 90a443f9c2437ca8a682a1ac625eba64e1d74a8a Closes #2395 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/googletest/pull/2395 from kuzkry:custom-type-traits-remove_reference 7f4f58da20e1066a888d3e4bcbef541db798a605 PiperOrigin-RevId: 266189044
* | post-review to db1b7399 (#2396)Krystian Kuzniarek2019-08-241-9/+9
| |
* | Googletest exportkuzkry2019-08-231-17/+13
| | | | | | | | | | | | | | | | | | Merge b8ca465e73ac0954a0c9eec2a84bdd8913d5763b into 90a443f9c2437ca8a682a1ac625eba64e1d74a8a Closes #2396 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/googletest/pull/2396 from kuzkry:custom-type-traits-true/false_type-and-bool_constant b8ca465e73ac0954a0c9eec2a84bdd8913d5763b PiperOrigin-RevId: 265064856
* | Merge pull request #2393 from kuzkry:custom-type-traits-remove_constXiaoyi Zhang2019-08-211-18/+19
|\ \ | |/ |/| | | PiperOrigin-RevId: 264652890
| * remove a custom implementation of std::remove_constKrystian Kuzniarek2019-08-141-18/+19
| |
* | remove a custom implementation of std::is_referenceKrystian Kuzniarek2019-08-141-1/+1
|/
* fix typosKrystian Kuzniarek2019-07-301-12/+12
|
* MSVC C5046 warning is unavailable in MSVC 2015.David Benjamin2019-04-091-2/+9
| | | | | | | | | | | | | | | | Per the MSVC documentation the warning is new as of Visual Studio 2017, version 15.8. https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5046?view=vs-2019 GTest users building on MSVC 2015 or older versions of 2017 will, when C4616 is enabled, see a warning like: [...]gtest-matchers.h(53): error C2220: warning treated as error - no 'object' file generated [...]gtest-matchers.h(53): warning C4619: #pragma warning: there is no warning number '5046' Guard the mention of 5046 by an _MSC_VER check. VS2017 15.8 corresponds to an _MSC_VER of 1915. https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019
* Googletest exportAbseil Team2019-04-011-6/+6
| | | | | | | | Remove support for "global" ::string and ::wstring types. This support existed for legacy codebases that existed from before namespaces where a thing. It is no longer necessary. PiperOrigin-RevId: 241335738
* Googletest exportAbseil Team2019-01-231-0/+113
| | | | | | | | | | | Add AllOfArray matcher that verifies a value matches all member of some array/container/list/set/..., e.g: EXPECT_THAT(1, AnyOfArray({1, 2, 3})) In the simplest form this is identical to AnyOf(1, 2, 3). But unlike that one it works on containers. Add AnyOfArray matcher that verifies a value matches any member of some array/container/list/set/... PiperOrigin-RevId: 230403653
* Googletest exportAbseil Team2019-01-141-6/+6
| | | | | | Add move-only argument support to almost all remaining matchers. PiperOrigin-RevId: 229030728
* Googletest exportmisterg2019-01-081-4/+4
| | | | | | | Replace testing::internal::ImplicitlyConvertible with std::is_convertible Fixes #2054 PiperOrigin-RevId: 228334305
* Googletest exportmisterg2019-01-021-3/+0
| | | | | | Internal Change PiperOrigin-RevId: 227575279
* Googletest exportAbseil Team2019-01-021-23/+16
| | | | | | | | Remove the #ifs for old, unsupported and buggy compilers: * old versions of GCC & MSVC * Symbian PiperOrigin-RevId: 227116941
* Googletest exportAbseil Team2018-12-201-62/+1
| | | | | | Unifdef c++11-related macros from googletest now that it requires C++11. PiperOrigin-RevId: 225905601
* Googletest exportAbseil Team2018-12-171-28/+17
| | | | | | Remove GTEST_REFERENCE_TO_CONST_ usage from GMock. In C++11, it's redundant. PiperOrigin-RevId: 225719210
* Googletest exportAbseil Team2018-12-171-12/+18
| | | | | | Allow container matchers to accept move-only containers. PiperOrigin-RevId: 225667441
* Googletest exportAbseil Team2018-12-121-2/+12
| | | | | | | | | | | | | | The gmock matchers have a concept of MatchAndExpain; where the details of the matching are written to a "result listener". A matcher can avoid creating expensive debug info by checking result_listener->IsInterested(); but, unfortunately, the default matcher code (called from EXPECT_THAT) is always "interested". This change implements EXPECT_THAT matching to first run the matcher in a "not interested" mode; and then run it a second time ("interested") only if the match fails. PiperOrigin-RevId: 225036073
* Googletest exportmisterg2018-12-111-12/+2
| | | | | | rollback of 224929783 PiperOrigin-RevId: 225008559