simplifies TrulyMatcher and adds a test for it
This commit is contained in:
@@ -1392,15 +1392,15 @@ class TrulyMatcher {
|
||||
template <typename T>
|
||||
bool MatchAndExplain(T& x, // NOLINT
|
||||
MatchResultListener* /* listener */) const {
|
||||
#ifdef _MSC_VER
|
||||
// MSVC warns about converting a value into bool (warning 4800).
|
||||
# pragma warning(push) // Saves the current warning state.
|
||||
# pragma warning(disable:4800) // Temporarily disables warning 4800.
|
||||
#endif
|
||||
return predicate_(x);
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop) // Restores the warning state.
|
||||
#endif
|
||||
// Without the if-statement, MSVC sometimes warns about converting
|
||||
// a value to bool (warning 4800).
|
||||
//
|
||||
// We cannot write 'return !!predicate_(x);' as that doesn't work
|
||||
// when predicate_(x) returns a class convertible to bool but
|
||||
// having no operator!().
|
||||
if (predicate_(x))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void DescribeTo(::std::ostream* os) const {
|
||||
|
||||
Reference in New Issue
Block a user