diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-08-19 23:25:59 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-08-20 00:09:53 +0300 |
commit | 759857fab05dac463877ff6ef8b8776ff2076f47 (patch) | |
tree | 4fe3b988759a9301a8ad04cbd4abc83765d549e3 /contrib/restricted/googletest/googlemock/src | |
parent | fe66a32be1aa1ad38fecdd32a7c4fd1ba72d3685 (diff) | |
download | ydb-759857fab05dac463877ff6ef8b8776ff2076f47.tar.gz |
Update contrib/restricted/googletest to 1.14.0
Diffstat (limited to 'contrib/restricted/googletest/googlemock/src')
4 files changed, 25 insertions, 21 deletions
diff --git a/contrib/restricted/googletest/googlemock/src/gmock-internal-utils.cc b/contrib/restricted/googletest/googlemock/src/gmock-internal-utils.cc index 7bfff02a33..5c2ce0d57e 100644 --- a/contrib/restricted/googletest/googlemock/src/gmock-internal-utils.cc +++ b/contrib/restricted/googletest/googlemock/src/gmock-internal-utils.cc @@ -41,6 +41,7 @@ #include <cctype> #include <cstdint> #include <cstring> +#include <iostream> #include <ostream> // NOLINT #include <string> #include <vector> @@ -87,7 +88,7 @@ GTEST_API_ std::string ConvertIdentifierNameToWords(const char* id_name) { (!IsDigit(prev_char) && IsDigit(*p)); if (IsAlNum(*p)) { - if (starts_new_word && result != "") result += ' '; + if (starts_new_word && !result.empty()) result += ' '; result += ToLower(*p); } } @@ -198,6 +199,10 @@ GTEST_API_ void IllegalDoDefault(const char* file, int line) { "the variable in various places."); } +constexpr char UndoWebSafeEncoding(char c) { + return c == '-' ? '+' : c == '_' ? '/' : c; +} + constexpr char UnBase64Impl(char c, const char* const base64, char carry) { return *base64 == 0 ? static_cast<char>(65) : *base64 == c @@ -208,7 +213,8 @@ constexpr char UnBase64Impl(char c, const char* const base64, char carry) { template <size_t... I> constexpr std::array<char, 256> UnBase64Impl(IndexSequence<I...>, const char* const base64) { - return {{UnBase64Impl(static_cast<char>(I), base64, 0)...}}; + return { + {UnBase64Impl(UndoWebSafeEncoding(static_cast<char>(I)), base64, 0)...}}; } constexpr std::array<char, 256> UnBase64(const char* const base64) { diff --git a/contrib/restricted/googletest/googlemock/src/gmock-matchers.cc b/contrib/restricted/googletest/googlemock/src/gmock-matchers.cc index 5810b6aa39..07bba4f010 100644 --- a/contrib/restricted/googletest/googlemock/src/gmock-matchers.cc +++ b/contrib/restricted/googletest/googlemock/src/gmock-matchers.cc @@ -53,7 +53,7 @@ GTEST_API_ std::string FormatMatcherDescription( bool negation, const char* matcher_name, const std::vector<const char*>& param_names, const Strings& param_values) { std::string result = ConvertIdentifierNameToWords(matcher_name); - if (param_values.size() >= 1) { + if (!param_values.empty()) { result += " " + JoinAsKeyValueTuple(param_names, param_values); } return negation ? "not (" + result + ")" : result; diff --git a/contrib/restricted/googletest/googlemock/src/gmock-spec-builders.cc b/contrib/restricted/googletest/googlemock/src/gmock-spec-builders.cc index 7cc3bcc28d..a1d8a6ebd5 100644 --- a/contrib/restricted/googletest/googlemock/src/gmock-spec-builders.cc +++ b/contrib/restricted/googletest/googlemock/src/gmock-spec-builders.cc @@ -40,6 +40,7 @@ #include <map> #include <memory> #include <set> +#include <sstream> #include <string> #include <unordered_map> #include <vector> @@ -48,20 +49,17 @@ #include "gtest/gtest.h" #include "gtest/internal/gtest-port.h" -#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC +#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC) #include <unistd.h> // NOLINT #endif -#if GTEST_OS_QURT +#ifdef GTEST_OS_QURT #error #include <qurt_event.h> #endif // Silence C4800 (C4800: 'int *const ': forcing value // to bool 'true' or 'false') for MSVC 15 -#ifdef _MSC_VER -#if _MSC_VER == 1900 -#pragma warning(push) -#pragma warning(disable : 4800) -#endif +#if defined(_MSC_VER) && (_MSC_VER == 1900) +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800) #endif namespace testing { @@ -98,7 +96,7 @@ ExpectationBase::ExpectationBase(const char* a_file, int a_line, action_count_checked_(false) {} // Destructs an ExpectationBase object. -ExpectationBase::~ExpectationBase() {} +ExpectationBase::~ExpectationBase() = default; // Explicitly specifies the cardinality of this expectation. Used by // the subclasses to implement the .Times() clause. @@ -300,7 +298,7 @@ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) { "See " "https://github.com/google/googletest/blob/main/docs/" "gmock_cook_book.md#" - "knowing-when-to-expect for details.\n", + "knowing-when-to-expect-useoncall for details.\n", stack_frames_to_skip); break; default: // FAIL @@ -311,7 +309,7 @@ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) { UntypedFunctionMockerBase::UntypedFunctionMockerBase() : mock_obj_(nullptr), name_("") {} -UntypedFunctionMockerBase::~UntypedFunctionMockerBase() {} +UntypedFunctionMockerBase::~UntypedFunctionMockerBase() = default; // Sets the mock object this mock method belongs to, and registers // this information in the global mock registry. Will be called @@ -506,7 +504,7 @@ class MockObjectRegistry { std::cout << internal::FormatFileLocation(state.first_used_file, state.first_used_line); std::cout << " ERROR: this mock object"; - if (state.first_used_test != "") { + if (!state.first_used_test.empty()) { std::cout << " (used in test " << state.first_used_test_suite << "." << state.first_used_test << ")"; } @@ -529,7 +527,7 @@ class MockObjectRegistry { // RUN_ALL_TESTS() has already returned when this destructor is // called. Therefore we cannot use the normal Google Test // failure reporting mechanism. -#if GTEST_OS_QURT +#ifdef GTEST_OS_QURT qurt_exception_raise_fatal(); #else _exit(1); // We cannot call exit() as it is not reentrant and @@ -748,13 +746,13 @@ void Mock::ClearDefaultActionsLocked(void* mock_obj) // needed by VerifyAndClearExpectationsLocked(). } -Expectation::Expectation() {} +Expectation::Expectation() = default; Expectation::Expectation( const std::shared_ptr<internal::ExpectationBase>& an_expectation_base) : expectation_base_(an_expectation_base) {} -Expectation::~Expectation() {} +Expectation::~Expectation() = default; // Adds an expectation to a sequence. void Sequence::AddExpectation(const Expectation& expectation) const { @@ -788,8 +786,6 @@ InSequence::~InSequence() { } // namespace testing -#ifdef _MSC_VER -#if _MSC_VER == 1900 -#pragma warning(pop) -#endif +#if defined(_MSC_VER) && (_MSC_VER == 1900) +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4800 #endif diff --git a/contrib/restricted/googletest/googlemock/src/gmock.cc b/contrib/restricted/googletest/googlemock/src/gmock.cc index 5025656a02..b5e714da7d 100644 --- a/contrib/restricted/googletest/googlemock/src/gmock.cc +++ b/contrib/restricted/googletest/googlemock/src/gmock.cc @@ -29,6 +29,8 @@ #include "gmock/gmock.h" +#include <string> + #include "gmock/internal/gmock-port.h" GMOCK_DEFINE_bool_(catch_leaked_mocks, true, |