| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Ensure `.what()` is printed in `ThrowsMessage(...)` to address https://github.com/google/googletest/issues/3582
Closes #3582
PiperOrigin-RevId: 399462851
|
|
|
|
|
|
| |
Introduce a new matcher for unescaping Base-64 strings to gmock.
PiperOrigin-RevId: 388471904
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Introduce GTEST_FLAG_GET and GTEST_FLAG_SET macros.
PiperOrigin-RevId: 382808313
|
|
|
|
|
|
| |
Implement 'Contains(e).Times(n)' matcher modifier which allows to test for arbitrary occurrences including absence with Times(0).
PiperOrigin-RevId: 382210276
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Introduce a new `Address` matcher to gmock.
PiperOrigin-RevId: 346344591
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Add ::testing::FieldsAre matcher for objects that support get<> and structured bindings.
PiperOrigin-RevId: 337165285
|
|\
| |
| |
| | |
PiperOrigin-RevId: 327294137
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
nitpicks.
|
| | |
|
| | |
|
|/
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Move matchers' tests from *generated* to common files.
PiperOrigin-RevId: 320954068
|
|
|
|
|
|
| |
Change string matchers, like HasSubstr, to accept `string_view` input if available.
PiperOrigin-RevId: 315726484
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Use a polymorphic matcher instead of the GreaterThan<int> test matcher
to fix the sign-comparison warning on MSVC.
PiperOrigin-RevId: 301163657
|
|
|
|
|
|
|
| |
Relax the implementation of MatcherCast to allow conversion of `Matcher<T>` to
`Matcher<const T&>`. They have the same match signature.
PiperOrigin-RevId: 297115843
|
|
|
|
|
|
| |
Add gmock Matcher<std::string_view> specialization.
PiperOrigin-RevId: 294443240
|
|
|
|
|
|
|
| |
Fix use of reserved names.
Minimize code duplication needed for explict-vs-nonexplicit constructor.
PiperOrigin-RevId: 292555014
|
|\
| |
| |
| |
| |
| | |
bysreg:fix_noshortcircuitfailure_detectsflakyshortcircuit_test
PiperOrigin-RevId: 290256504
|
| |
| |
| |
| | |
gmock-matchers_test.cc
|
|/
|
|
| |
DetectsFlakyShortCircuit when GTEST_HAS_RTTI is 1
|
|\
| |
| |
| |
| |
| | |
kuzkry:remove-workaround_msvc-namespace-scope-from-nested-class
PiperOrigin-RevId: 282593823
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| |
| | |
PiperOrigin-RevId: 275842505
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)
|
| |
| |
| |
| |
| |
| | |
Rolling forward IsNan() matcher with fixes in test for -Wconversion issues. Use
std::nanf and std::nanl where appropriate.
PiperOrigin-RevId: 275523003
|
| |
| |
| |
| |
| |
| | |
Added IsNan matcher
PiperOrigin-RevId: 275473218
|
| |
| |
| |
| |
| |
| | |
Added IsNan matcher
PiperOrigin-RevId: 275278634
|
|/
|
|
|
|
| |
Makes testing::ResultOf() work with non-copyable arguments.
PiperOrigin-RevId: 271222632
|
|
|
|
|
| |
Due to confusion arisen from "iff" standing for "if and only if",
this commit uses the latter.
|
| |
|
| |
|
| |
|
|\
| |
| |
| | |
PiperOrigin-RevId: 244069956
|
|/
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Comment out unused method parameters in their relevant definitions.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
|
|
|
|
|
|
|
|
| |
`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>
|
|
|
|
|
|
|
| |
Provide dummy accessors for private values that are set in initializers,
but not actually used.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|