summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest/gtest-matchers.h
Commit message (Collapse)AuthorAgeFilesLines
* Use '=default' to define trivial constructor/destructorsrefs/pull/4221/headTom Hughes2023-04-211-6/+6
| | | | | | | https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html PiperOrigin-RevId: 526079054 Change-Id: Ia4db21e3e5f58b90de05d52fd94b291ed06d785d
* [gtest] Drop custom-rolled heterogeneous comparator functors in favor of C++ ↵Lawrence Wolf-Sonkin2023-03-101-49/+16
| | | | | | | | | | standard ones * Standard heterogeneous comparator functors such as `std::equal_to<>` and `std::less<>` [have been available since C++14](https://en.cppreference.com/w/cpp/utility/functional/less_void) * Now that [C++14 is the minimum supported version of C++ in Googletest](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md), let's delete these duplications of the standard library PiperOrigin-RevId: 515743068 Change-Id: I1563a2f94039c3a6688429298555545a922f6d7e
* Explicitly instantiate matchee std::string in MatchesRegexDino Radakovic2022-08-041-1/+1
| | | | | | | | | If this ever turns out to be a performance issue, we could use std::conditional and std::is_same to avoid copying std::strings. Fixes #3949 PiperOrigin-RevId: 465353572 Change-Id: If2d691bccb626c692c87e006df5afe88a4ed1542
* Merge pull request #3797 from glandium:issue3514Copybara-Service2022-04-261-3/+4
|\ | | | | | | | | PiperOrigin-RevId: 444444700 Change-Id: I8ac5cc96cc6eb9d583fa7e3fb304ef3dcaa95b5b
| * Always initialize fields in MatcherBase constructorsrefs/pull/3797/headMike Hommey2022-04-201-3/+4
| | | | | | | | | | | | This fixes -Wuninitialized warnings with GCC. Fixes #3514.
* | Remove the legacy internal GTEST_DISALLOW_* macrosDerek Mauro2022-04-221-3/+7
|/ | | | | PiperOrigin-RevId: 443715444 Change-Id: I3ffd54b63d2728ae4a668ee7875c8c3c8188087c
* Running clang-format over all of GoogleTestAbseil Team2022-03-151-19/+36
| | | | | | | | | | | | | | | | A few tests are examining code locations and looking af the resulting line numbers to verify that GoogleTest shows those to users correctly. Some of those locations change when clang-format is run. For those locations, I've wrapped portions in: // clang-format off ... // clang-format on There may be other locations that are currently not tickled by running clang-format. PiperOrigin-RevId: 434844712 Change-Id: I3a9f0a6f39eff741c576b6de389bef9b1d11139d
* Consistently apply IWYU pragmas across googletest and googlemock headersAbseil Team2022-01-181-0/+4
| | | | | PiperOrigin-RevId: 422559250 Change-Id: I9f630f2186724950e5e9fbd7093d5264e8bf0a71
* Googletest exportdmauro2021-06-081-1/+1
| | | | | | | | | | Fix MSVC warning C4275: non dll-interface class 'testing::MatcherDescriberInterface' used as base for dll-interface class 'testing::internal::MatcherBase<std::string>' Fixes #3415 PiperOrigin-RevId: 377352684
* Googletest exportAbseil Team2021-02-181-3/+3
| | | | | | Make include guards conform with https://google.github.io/styleguide/cppguide.html#The__define_Guard, attempt #2 PiperOrigin-RevId: 357056902
* Googletest exportAbseil Team2021-02-111-3/+3
| | | | | | Revert include guard fix PiperOrigin-RevId: 356588893
* Googletest exportAbseil Team2021-02-111-3/+3
| | | | | | Make include guards conform with https://google.github.io/styleguide/cppguide.html#The__define_Guard PiperOrigin-RevId: 355882793
* Googletest exportAbseil Team2021-02-051-4/+0
| | | | | | Delete Google-internal IWYU pragmas PiperOrigin-RevId: 355398547
* Googletest exportAbseil Team2021-02-051-0/+1
| | | | | | Document the fact that MatchAndExplain(T, MatchResultListener*) is supported. PiperOrigin-RevId: 354172275
* Googletest exportdmauro2021-01-141-1/+1
| | | | | | Fix build under GCC 5 PiperOrigin-RevId: 351607537
* Googletest exportAbseil Team2021-01-141-1/+5
| | | | | | | | | | Launder buffer before reference In GCC, directly casting the Buffer reference to another type results in strict-aliasing violation errors. This launders the reference using an intermediate pointer prior to creating the new reference. PiperOrigin-RevId: 350809323
* Googletest exportAbseil Team2021-01-141-82/+255
| | | | | | | | | | | | Change Matcher<T> to allow binding an implementation by value directly: - Drop the requirement of MatcherInterface. Doing manual type erasure avoid extra layers in many cases. - Avoid the adaptor for `MatcherInterface<T>` and `MatcherInterface<const T&>` mismatch. - Use a small object optimization when possible. This makes things like `_` and `Eq(1)` really cheap and do not require memory allocations. - Migrate some matchers to the new model to speed them up and to test the new framework. More matchers to come in future changes. PiperOrigin-RevId: 350580998
* Googletest exportAbseil Team2020-06-101-6/+12
| | | | | | Change string matchers, like HasSubstr, to accept `string_view` input if available. PiperOrigin-RevId: 315726484
* Googletest exportAbseil Team2020-02-111-19/+19
| | | | | | Add gmock Matcher<std::string_view> specialization. PiperOrigin-RevId: 294443240
* Add many missing override keywordsrefs/pull/2475/headPeter Barker2019-09-251-3/+3
| | | | This helps corrects builds with -Werror=suggest-overrides
* Merge pull request #2387 from kuzkry:iffShaindel Schwartz2019-09-121-7/+7
|\ | | | | | | PiperOrigin-RevId: 268693457
| * restore mistakenly removed iffs in their explicit formrefs/pull/2387/headKrystian Kuzniarek2019-08-201-7/+7
| | | | | | | | | | Due to confusion arisen from "iff" standing for "if and only if", this commit uses the latter.
* | Merge pull request #2400 from kuzkry:custom-type-traits-enable_ifXiaoyi Zhang2019-08-231-2/+2
|\ \ | |/ |/| | | PiperOrigin-RevId: 264693952
| * remove a custom implementation of std::enable_ifKrystian Kuzniarek2019-08-131-5/+7
| |
* | remove custom implementations of std::is_samerefs/pull/2399/headKrystian Kuzniarek2019-08-141-5/+7
|/
* fix typosrefs/pull/2356/headKrystian Kuzniarek2019-07-301-4/+4
|
* MSVC C5046 warning is unavailable in MSVC 2015.refs/pull/2226/headDavid 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-74/+1
| | | | | | | | 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-02-121-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix matcher comparisons for std::reference_wrapper. The googletest docs indicate that std::reference_wrapper should be used to for objects that should not be copied by the matcher (in fact, the ByRef() function is basically the same as a call to std::cref). However, for many types (such as std::string), the overloaded operator== will not resolve correctly. Specifically, this is problematic if operator== depends on template argument deduction, where the same type is named on LHS and RHS. Because template argument deduction happens before any implict conversions for purposes of overload resolution, attempting to compare T with std::reference_wrapper<T> simply looks like a comparison of unlike types. For exapmle, std::reference_wrapper<std::string> is implicitly convertible to 'const std::string&', which would be able to choose an overload specialization of operator==. However, the implicit conversion can only happen after template argument deduction for operator==, so a specialization that would other be an applicable overload is never considered. Note also that this change only affects matchers. There are good reasons that matchers may need to transparently hold a std::reference_wrapper. Other comparisons (like EXPECT_EQ, et. al.) don't need to capture a reference: they don't need to defer evaluation (as in googlemock), and they don't need to avoid copies (as the call chain of matchers does). PiperOrigin-RevId: 232499175
* Googletest exportAbseil Team2019-01-141-7/+6
| | | | | | Add move-only argument support to almost all remaining matchers. PiperOrigin-RevId: 229030728
* Googletest exportAbseil Team2019-01-101-8/+5
| | | | | | | | | | Fix warning about deprecation of implicit operations such as copy constructors or assignment operators. Specifically: MatcherBase's default copy constructor, assignment operator, move operator, and move assignment operator are now declared explicitly rather than depending on the compiler implicit generation (which is disallowed/warned against due to MatcherBase's declaration of the destructor). PiperOrigin-RevId: 228573333
* Googletest exportmisterg2019-01-021-4/+0
| | | | | | Internal Change PiperOrigin-RevId: 227575279
* Googletest exportAbseil Team2018-12-171-18/+11
| | | | | | Remove GTEST_REFERENCE_TO_CONST_ usage from GMock. In C++11, it's redundant. PiperOrigin-RevId: 225719210
* Googletest exportAbseil Team2018-12-031-9/+10
| | | | | | Applied fixes for ClangTidy modernize-use-override and modernize-use-using. PiperOrigin-RevId: 223800219
* Googletest exportdurandal2018-11-291-1/+147
| | | | | | Accept gmock matchers in EXPECT_EXIT and friends to allow matches other than simple regex matches on death output. PiperOrigin-RevId: 223035409
* Googletest exportAbseil Team2018-11-201-1/+1
| | | | | | Point IWYU at an existent path. PiperOrigin-RevId: 221797154
* Googletest exportdurandal2018-11-201-0/+677
Move the Matcher<T> interface to googletest so I can use it to extend death test regex matching in a subsequent change. PiperOrigin-RevId: 221675910