| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -122,6 +122,10 @@ | |||
| 122 | 122 | #include "gtest/internal/gtest-internal.h" | |
| 123 | 123 | #include "gtest/internal/gtest-port.h" | |
| 124 | 124 | ||
| 125 | + #if GTEST_INTERNAL_HAS_STD_SPAN | ||
| 126 | + #include <span> // NOLINT | ||
| 127 | + #endif // GTEST_INTERNAL_HAS_STD_SPAN | ||
| 128 | + | ||
| 125 | 129 | namespace testing { | |
| 126 | 130 | ||
| 127 | 131 | // Definitions in the internal* namespaces are subject to change without notice. | |
@@ -131,13 +135,32 @@ namespace internal { | |||
| 131 | 135 | template <typename T> | |
| 132 | 136 | void UniversalPrint(const T& value, ::std::ostream* os); | |
| 133 | 137 | ||
| 138 | + template <typename T> | ||
| 139 | + struct IsStdSpan { | ||
| 140 | + static constexpr bool value = false; | ||
| 141 | + }; | ||
| 142 | + | ||
| 143 | + #if GTEST_INTERNAL_HAS_STD_SPAN | ||
| 144 | + template <typename E> | ||
| 145 | + struct IsStdSpan<std::span<E>> { | ||
| 146 | + static constexpr bool value = true; | ||
| 147 | + }; | ||
| 148 | + #endif // GTEST_INTERNAL_HAS_STD_SPAN | ||
| 149 | + | ||
| 134 | 150 | // Used to print an STL-style container when the user doesn't define | |
| 135 | 151 | // a PrintTo() for it. | |
| 152 | + // | ||
| 153 | + // NOTE: Since std::span does not have const_iterator until C++23, it would | ||
| 154 | + // fail IsContainerTest before C++23. However, IsContainerTest only uses | ||
| 155 | + // the presence of const_iterator to avoid treating iterators as containers | ||
| 156 | + // because of iterator::iterator. Which means std::span satisfies the *intended* | ||
| 157 | + // condition of IsContainerTest. | ||
| 136 | 158 | struct ContainerPrinter { | |
| 137 | 159 | template <typename T, | |
| 138 | 160 | typename = typename std::enable_if< | |
| 139 | - (sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)) && | ||
| 140 | - !IsRecursiveContainer<T>::value>::type> | ||
| 161 | + ((sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)) && | ||
| 162 | + !IsRecursiveContainer<T>::value) || | ||
| 163 | + IsStdSpan<T>::value>::type> | ||
| 141 | 164 | static void PrintValue(const T& container, std::ostream* os) { | |
| 142 | 165 | const size_t kMaxCount = 32; // The maximum number of elements to print. | |
| 143 | 166 | *os << '{'; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,7 +78,7 @@ | |||
| 78 | 78 | // | |
| 79 | 79 | // will result in the token foo__LINE__, instead of foo followed by | |
| 80 | 80 | // the current line number. For more details, see | |
| 81 | - // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6 | ||
| 81 | + // https://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6 | ||
| 82 | 82 | #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar) | |
| 83 | 83 | #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo##bar | |
| 84 | 84 | ||
@@ -169,7 +169,7 @@ namespace edit_distance { | |||
| 169 | 169 | // All edits cost the same, with replace having lower priority than | |
| 170 | 170 | // add/remove. | |
| 171 | 171 | // Simple implementation of the Wagner-Fischer algorithm. | |
| 172 | - // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm | ||
| 172 | + // See https://en.wikipedia.org/wiki/Wagner-Fischer_algorithm | ||
| 173 | 173 | enum EditType { kMatch, kAdd, kRemove, kReplace }; | |
| 174 | 174 | GTEST_API_ std::vector<EditType> CalculateOptimalEdits( | |
| 175 | 175 | const std::vector<size_t>& left, const std::vector<size_t>& right); | |
@@ -236,7 +236,7 @@ GTEST_API_ std::string GetBoolAssertionFailureMessage( | |||
| 236 | 236 | // For double, there are 11 exponent bits and 52 fraction bits. | |
| 237 | 237 | // | |
| 238 | 238 | // More details can be found at | |
| 239 | - // http://en.wikipedia.org/wiki/IEEE_floating-point_standard. | ||
| 239 | + // https://en.wikipedia.org/wiki/IEEE_floating-point_standard. | ||
| 240 | 240 | // | |
| 241 | 241 | // Template parameter: | |
| 242 | 242 | // | |
@@ -281,7 +281,7 @@ class FloatingPoint { | |||
| 281 | 281 | // bits. Therefore, 4 should be enough for ordinary use. | |
| 282 | 282 | // | |
| 283 | 283 | // See the following article for more details on ULP: | |
| 284 | - // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ | ||
| 284 | + // https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ | ||
| 285 | 285 | static const uint32_t kMaxUlps = 4; | |
| 286 | 286 | ||
| 287 | 287 | // Constructs a FloatingPoint from a raw floating-point number. | |
@@ -362,7 +362,7 @@ class FloatingPoint { | |||
| 362 | 362 | // N - 1 (the biggest number representable using | |
| 363 | 363 | // sign-and-magnitude) is represented by 2N - 1. | |
| 364 | 364 | // | |
| 365 | - // Read http://en.wikipedia.org/wiki/Signed_number_representations | ||
| 365 | + // Read https://en.wikipedia.org/wiki/Signed_number_representations | ||
| 366 | 366 | // for more details on signed number representations. | |
| 367 | 367 | static Bits SignAndMagnitudeToBiased(const Bits& sam) { | |
| 368 | 368 | if (kSignBitMask & sam) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -584,7 +584,9 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { | |||
| 584 | 584 | ||
| 585 | 585 | GTEST_CHECK_(IsValidParamName(param_name)) | |
| 586 | 586 | << "Parameterized test name '" << param_name | |
| 587 | - << "' is invalid, in " << file << " line " << line << std::endl; | ||
| 587 | + << "' is invalid (contains spaces, dashes, underscores, or " | ||
| 588 | + "non-alphanumeric characters), in " | ||
| 589 | + << file << " line " << line << "" << std::endl; | ||
| 588 | 590 | ||
| 589 | 591 | GTEST_CHECK_(test_param_names.count(param_name) == 0) | |
| 590 | 592 | << "Duplicate parameterized test name '" << param_name << "', in " | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -208,6 +208,8 @@ | |||
| 208 | 208 | // or | |
| 209 | 209 | // UniversalPrinter<absl::optional> | |
| 210 | 210 | // specializations. Always defined to 0 or 1. | |
| 211 | + // GTEST_INTERNAL_HAS_STD_SPAN - for enabling UniversalPrinter<std::span> | ||
| 212 | + // specializations. Always defined to 0 or 1 | ||
| 211 | 213 | // GTEST_INTERNAL_HAS_STRING_VIEW - for enabling Matcher<std::string_view> or | |
| 212 | 214 | // Matcher<absl::string_view> | |
| 213 | 215 | // specializations. Always defined to 0 or 1. | |
@@ -609,7 +611,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; | |||
| 609 | 611 | // Determines whether clone(2) is supported. | |
| 610 | 612 | // Usually it will only be available on Linux, excluding | |
| 611 | 613 | // Linux on the Itanium architecture. | |
| 612 | - // Also see http://linux.die.net/man/2/clone. | ||
| 614 | + // Also see https://linux.die.net/man/2/clone. | ||
| 613 | 615 | #ifndef GTEST_HAS_CLONE | |
| 614 | 616 | // The user didn't tell us, so we need to figure it out. | |
| 615 | 617 | ||
@@ -2407,6 +2409,16 @@ inline ::std::nullopt_t Nullopt() { return ::std::nullopt; } | |||
| 2407 | 2409 | #define GTEST_INTERNAL_HAS_OPTIONAL 0 | |
| 2408 | 2410 | #endif | |
| 2409 | 2411 | ||
| 2412 | + #ifdef __has_include | ||
| 2413 | + #if __has_include(<span>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L | ||
| 2414 | + #define GTEST_INTERNAL_HAS_STD_SPAN 1 | ||
| 2415 | + #endif // __has_include(<span>) && GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L | ||
| 2416 | + #endif // __has_include | ||
| 2417 | + | ||
| 2418 | + #ifndef GTEST_INTERNAL_HAS_STD_SPAN | ||
| 2419 | + #define GTEST_INTERNAL_HAS_STD_SPAN 0 | ||
| 2420 | + #endif | ||
| 2421 | + | ||
| 2410 | 2422 | #ifdef GTEST_HAS_ABSL | |
| 2411 | 2423 | // Always use absl::string_view for Matcher<> specializations if googletest | |
| 2412 | 2424 | // is built with absl support. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -783,7 +783,7 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() { | |||
| 783 | 783 | StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) + | |
| 784 | 784 | // size_t has the same width as pointers on both 32-bit and 64-bit | |
| 785 | 785 | // Windows platforms. | |
| 786 | - // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx. | ||
| 786 | + // See https://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx. | ||
| 787 | 787 | "|" + StreamableToString(reinterpret_cast<size_t>(write_handle)) + "|" + | |
| 788 | 788 | StreamableToString(reinterpret_cast<size_t>(event_handle_.Get())); | |
| 789 | 789 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -312,7 +312,7 @@ void ShuffleRange(internal::Random* random, int begin, int end, | |||
| 312 | 312 | << begin << ", " << size << "]."; | |
| 313 | 313 | ||
| 314 | 314 | // Fisher-Yates shuffle, from | |
| 315 | - // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle | ||
| 315 | + // https://en.wikipedia.org/wiki/Fisher-Yates_shuffle | ||
| 316 | 316 | for (int range_width = end - begin; range_width >= 2; range_width--) { | |
| 317 | 317 | const int last_in_range = begin + range_width - 1; | |
| 318 | 318 | const int selected = | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -879,7 +879,7 @@ int UnitTestOptions::GTestProcessSEH(DWORD seh_code, const char* location) { | |||
| 879 | 879 | // apparently). | |
| 880 | 880 | // | |
| 881 | 881 | // SEH exception code for C++ exceptions. | |
| 882 | - // (see http://support.microsoft.com/kb/185294 for more information). | ||
| 882 | + // (see https://support.microsoft.com/kb/185294 for more information). | ||
| 883 | 883 | const DWORD kCxxExceptionCode = 0xe06d7363; | |
| 884 | 884 | ||
| 885 | 885 | if (!GTEST_FLAG_GET(catch_exceptions) || seh_code == kCxxExceptionCode || | |
@@ -3228,7 +3228,8 @@ static const char* GetAnsiColorCode(GTestColor color) { | |||
| 3228 | 3228 | case GTestColor::kYellow: | |
| 3229 | 3229 | return "3"; | |
| 3230 | 3230 | default: | |
| 3231 | - return nullptr; | ||
| 3231 | + assert(false); | ||
| 3232 | + return "9"; | ||
| 3232 | 3233 | } | |
| 3233 | 3234 | } | |
| 3234 | 3235 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ This a list of all the dependencies: | |||
| 15 | 15 | * [c-ares 1.19.0][] | |
| 16 | 16 | * [cjs-module-lexer 1.2.2][] | |
| 17 | 17 | * [corepack][] | |
| 18 | - * [googletest 7e33b6a][] | ||
| 18 | + * [googletest 8a6feab][] | ||
| 19 | 19 | * [histogram 0.11.8][] | |
| 20 | 20 | * [icu-small 73.2][] | |
| 21 | 21 | * [libuv 1.46.0][] | |
@@ -189,7 +189,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to | |||
| 189 | 189 | install them - just like what currently happens with npm, which is shipped | |
| 190 | 190 | by Node.js by default. | |
| 191 | 191 | ||
| 192 | - ### googletest 7e33b6a | ||
| 192 | + ### googletest 8a6feab | ||
| 193 | 193 | ||
| 194 | 194 | The [googletest](https://github.com/google/googletest) dependency is Google’s | |
| 195 | 195 | C++ testing and mocking framework. | |
@@ -326,7 +326,7 @@ performance improvements not currently available in standard zlib. | |||
| 326 | 326 | [cjs-module-lexer 1.2.2]: #cjs-module-lexer-122 | |
| 327 | 327 | [corepack]: #corepack | |
| 328 | 328 | [dependency-update-action]: ../../../.github/workflows/tools.yml | |
| 329 | - [googletest 7e33b6a]: #googletest-7e33b6a | ||
| 329 | + [googletest 8a6feab]: #googletest-8a6feab | ||
| 330 | 330 | [histogram 0.11.8]: #histogram-0118 | |
| 331 | 331 | [icu-small 73.2]: #icu-small-732 | |
| 332 | 332 | [libuv 1.46.0]: #libuv-1460 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments