summaryrefslogtreecommitdiff
path: root/googlemock/test/gmock-matchers_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Googletest exportAbseil Team2021-09-281-9/+6
| | | | | | | | Ensure `.what()` is printed in `ThrowsMessage(...)` to address https://github.com/google/googletest/issues/3582 Closes #3582 PiperOrigin-RevId: 399462851
* Googletest exportAbseil Team2021-08-041-0/+27
| | | | | | Introduce a new matcher for unescaping Base-64 strings to gmock. PiperOrigin-RevId: 388471904
* Googletest exportAbseil Team2021-07-071-0/+28
| | | | | | | | Add `Conditional` wrapper to gtest This follows an initial proposal for an 'EqIff` matcher. `Conditional` was considered more precise as an EqIff() matcher may suffer from `Iff` not being universally understood. PiperOrigin-RevId: 383407665
* Googletest exportAbseil Team2021-07-071-1/+1
| | | | | | Introduce GTEST_FLAG_GET and GTEST_FLAG_SET macros. PiperOrigin-RevId: 382808313
* Googletest exportAbseil Team2021-06-301-11/+86
| | | | | | Implement 'Contains(e).Times(n)' matcher modifier which allows to test for arbitrary occurrences including absence with Times(0). PiperOrigin-RevId: 382210276
* Googletest exportAbseil Team2021-01-131-1/+1
| | | | | | | | | | | | 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-12-081-0/+40
| | | | | | Introduce a new `Address` matcher to gmock. PiperOrigin-RevId: 346344591
* Googletest exportAbseil Team2020-12-071-0/+59
| | | | | | | | | Add a `Pointer` matcher as an analog to `Pointee`. Similar to `Pointee`, `Pointer` works with either raw or smart pointers and allows creating a matcher like Pointer(Eq(foo)) for smart pointers. PiperOrigin-RevId: 346164768
* Googletest exportAbseil Team2020-12-031-0/+5
| | | | | | Disable a gmock matcher test under MSVC 2015 (version 14) and earlier. It interacts badly with Windows structured exceptions in a way we do not have the resources to investigate. This test passes under MSVC 2017 and SEH. PiperOrigin-RevId: 345496734
* Googletest exportAbseil Team2020-11-091-0/+7
| | | | | | | | | | | | | | | | GMock: Make Truly explain when it fails I just wrote a test that had a matcher of the form Optional(AllOf( SomeMatcher, SomeOtherMatcher, Truly(SomePredicate))) The predicate failed, the other two matchers succeeded, and I got a hard-to-interpret message saying that the value in the optional "didn't match". Didn't match what? This change improves situations like that slightly by having Truly explain to its result listener when it fails. When there are multiple Trulys in an AllOf, there will be some ambiguity, but it will at least provide more information than right now. PiperOrigin-RevId: 341105141
* Googletest exportAbseil Team2020-10-141-0/+141
| | | | | Add ::testing::FieldsAre matcher for objects that support get<> and structured bindings. PiperOrigin-RevId: 337165285
* Merge pull request #2904 from AmatanHead:throw-matchersvslashg2020-08-231-0/+184
|\ | | | | | | PiperOrigin-RevId: 327294137
| * Remove ThrowsMessageHasSubstr and fix some nits after reviewVladimir Goncharov2020-08-031-49/+18
| |
| * Fix build under msvcVladimir Goncharov2020-08-031-5/+5
| |
| * Update tests after changing an error messageVladimir Goncharov2020-08-031-2/+2
| |
| * Add a test to ensure that the `Throws` matcher only invokes its argument once.Vladimir Goncharov2020-08-031-0/+30
| |
| * Add a test for duplicate catch clauses in throw matchers, fix a couple of ↵Vladimir Goncharov2020-08-031-0/+6
| | | | | | | | nitpicks.
| * Add missing documentation pieceVladimir Goncharov2020-08-031-0/+20
| |
| * Small improvements: code style and property nameVladimir Goncharov2020-08-031-4/+2
| |
| * Add matchers for testing exception propertiesVladimir Goncharov2020-08-031-0/+182
|/ | | | | | This PR adds matchers that accept a callable and verify that when invoked, it throws an exception with the given type and properties. Fixes #952
* Googletest exportofats2020-07-151-0/+1167
| | | | | | Move matchers' tests from *generated* to common files. PiperOrigin-RevId: 320954068
* Googletest exportAbseil Team2020-06-101-9/+36
| | | | | | Change string matchers, like HasSubstr, to accept `string_view` input if available. PiperOrigin-RevId: 315726484
* Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_.Arthur O'Dwyer2020-04-231-6/+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.
* Googletest exportdmauro2020-03-171-5/+3
| | | | | | | Use a polymorphic matcher instead of the GreaterThan<int> test matcher to fix the sign-comparison warning on MSVC. PiperOrigin-RevId: 301163657
* Googletest exportAbseil Team2020-02-281-4/+5
| | | | | | | 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-94/+95
| | | | | | Add gmock Matcher<std::string_view> specialization. PiperOrigin-RevId: 294443240
* Googletest exportAbseil Team2020-02-071-0/+27
| | | | | | | Fix use of reserved names. Minimize code duplication needed for explict-vs-nonexplicit constructor. PiperOrigin-RevId: 292555014
* Merge pull request #2665 from ↵Xiaoyi Zhang2020-01-211-3/+5
|\ | | | | | | | | | | bysreg:fix_noshortcircuitfailure_detectsflakyshortcircuit_test PiperOrigin-RevId: 290256504
| * Use IsReadableTypeName IsReadableTypeName in OfType function in ↵Muhammad Hilman Beyri2020-01-121-1/+1
| | | | | | | | gmock-matchers_test.cc
| * fix unit test failure on NoShortCircuitOnFailure and ↵Muhammad Hilman Beyri2020-01-121-2/+2
|/ | | | DetectsFlakyShortCircuit when GTEST_HAS_RTTI is 1
* Merge pull request #2593 from ↵Gennadiy Rozental2019-11-261-9/+4
|\ | | | | | | | | | | kuzkry:remove-workaround_msvc-namespace-scope-from-nested-class PiperOrigin-RevId: 282593823
| * remove MSVC workaround: accessing namespace scope from within nested classesKrystian Kuzniarek2019-11-221-9/+4
| |
* | Googletest exportAbseil Team2019-11-221-2/+3
|/ | | | | | | | | | | | | Use standard C++11 integer types in gtest-port.h. Remove testing::internal::{Int,Uint}{32,64} in favor of types guaranteed to be in <cstdint> since C++11. Tests for built-in integer type coverage are switched from {Int,Uint}64 to [unsigned] long long, which is guaranteed by C++11 to exist and be at least 64-bit wide. PiperOrigin-RevId: 281565263
* Merge pull request #2444 from kuzkry:remove-GTEST_ARRAY_SIZE_Gennadiy Civil2019-10-221-17/+21
|\ | | | | | | PiperOrigin-RevId: 275842505
| * remove GTEST_ARRAY_SIZE_Krystian Kuzniarek2019-09-231-15/+17
| | | | | | | | | | | | | | | | | | This macro didn't work when an array was passed to a function by pointer, in which case the information about its size was lost. Better alternatives are: * std::extent<T>::value (compile-time) * std::array<T, N>::size() (compile-time) * std::distance(std::begin(array), std::end(array)) (run-time)
* | Googletest exportAbseil Team2019-10-221-0/+108
| | | | | | | | | | | | 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-108/+0
| | | | | | | | | | | | Added IsNan matcher PiperOrigin-RevId: 275473218
* | Googletest exportAbseil Team2019-10-171-0/+108
| | | | | | | | | | | | Added IsNan matcher PiperOrigin-RevId: 275278634
* | Googletest exportAbseil Team2019-09-271-0/+10
|/ | | | | | Makes testing::ResultOf() work with non-copyable arguments. PiperOrigin-RevId: 271222632
* restore mistakenly removed iffs in their explicit formKrystian Kuzniarek2019-08-201-7/+6
| | | | | Due to confusion arisen from "iff" standing for "if and only if", this commit uses the latter.
* remove custom implementations of std::is_sameKrystian Kuzniarek2019-08-141-1/+1
|
* fix typosKrystian Kuzniarek2019-07-301-3/+3
|
* Fixed issue #2284 (Incompatibility with C++17)Tom Lachecki2019-06-131-2/+2
|
* Merge pull request #2170 from ngie-eign:issue-2146-ver2Gennadiy Civil2019-04-181-10/+13
|\ | | | | | | PiperOrigin-RevId: 244069956
| * clang: fix `-Wsign-conversion` errorsEnji Cooper2019-04-051-9/+11
|/ | | | | | | | | | | Cast some values as their unsigned equivalents or `size_t` to match the parameter type used for the template object under test. Also, provide UInt32 equivalent delegate methods for some callers (with int-equivalents for backwards compatibility). This closes #2146. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* Googletest exportAbseil Team2019-04-011-272/+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
* Fix clang `-Wunused-parameter` warningsEnji Cooper2019-02-131-1/+1
| | | | | | Comment out unused method parameters in their relevant definitions. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* Fix clang `-Winconsistent-missing-override` warningsEnji Cooper2019-02-131-3/+3
| | | | | | | | `DescribeTo(..)` and `MatchAndExplain(..)` in `gmock-matchers_test` both override virtual methods. Remove the `virtual` keyword and apply `override` to them instead. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* Fix -Wunused-private-field issues with clangEnji Cooper2019-02-121-0/+2
| | | | | | | Provide dummy accessors for private values that are set in initializers, but not actually used. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
* Googletest exportAbseil Team2019-02-121-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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