Skip to content

Commit 9c7b7be

Browse files
deps: update googletest to 8a6feab
PR-URL: #49463 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent a33a497 commit 9c7b7be

File tree

8 files changed

+54
-16
lines changed

8 files changed

+54
-16
lines changed

deps/googletest/include/gtest/gtest-printers.h

+25-2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@
122122
#include "gtest/internal/gtest-internal.h"
123123
#include "gtest/internal/gtest-port.h"
124124

125+
#if GTEST_INTERNAL_HAS_STD_SPAN
126+
#include <span> // NOLINT
127+
#endif // GTEST_INTERNAL_HAS_STD_SPAN
128+
125129
namespace testing {
126130

127131
// Definitions in the internal* namespaces are subject to change without notice.
@@ -131,13 +135,32 @@ namespace internal {
131135
template <typename T>
132136
void UniversalPrint(const T& value, ::std::ostream* os);
133137

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+
134150
// Used to print an STL-style container when the user doesn't define
135151
// 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.
136158
struct ContainerPrinter {
137159
template <typename T,
138160
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>
141164
static void PrintValue(const T& container, std::ostream* os) {
142165
const size_t kMaxCount = 32; // The maximum number of elements to print.
143166
*os << '{';

deps/googletest/include/gtest/internal/gtest-internal.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
//
7979
// will result in the token foo__LINE__, instead of foo followed by
8080
// 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
8282
#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
8383
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo##bar
8484

@@ -169,7 +169,7 @@ namespace edit_distance {
169169
// All edits cost the same, with replace having lower priority than
170170
// add/remove.
171171
// 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
173173
enum EditType { kMatch, kAdd, kRemove, kReplace };
174174
GTEST_API_ std::vector<EditType> CalculateOptimalEdits(
175175
const std::vector<size_t>& left, const std::vector<size_t>& right);
@@ -236,7 +236,7 @@ GTEST_API_ std::string GetBoolAssertionFailureMessage(
236236
// For double, there are 11 exponent bits and 52 fraction bits.
237237
//
238238
// 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.
240240
//
241241
// Template parameter:
242242
//
@@ -281,7 +281,7 @@ class FloatingPoint {
281281
// bits. Therefore, 4 should be enough for ordinary use.
282282
//
283283
// 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/
285285
static const uint32_t kMaxUlps = 4;
286286

287287
// Constructs a FloatingPoint from a raw floating-point number.
@@ -362,7 +362,7 @@ class FloatingPoint {
362362
// N - 1 (the biggest number representable using
363363
// sign-and-magnitude) is represented by 2N - 1.
364364
//
365-
// Read http://en.wikipedia.org/wiki/Signed_number_representations
365+
// Read https://en.wikipedia.org/wiki/Signed_number_representations
366366
// for more details on signed number representations.
367367
static Bits SignAndMagnitudeToBiased(const Bits& sam) {
368368
if (kSignBitMask & sam) {

deps/googletest/include/gtest/internal/gtest-param-util.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,9 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
584584

585585
GTEST_CHECK_(IsValidParamName(param_name))
586586
<< "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;
588590

589591
GTEST_CHECK_(test_param_names.count(param_name) == 0)
590592
<< "Duplicate parameterized test name '" << param_name << "', in "

deps/googletest/include/gtest/internal/gtest-port.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@
208208
// or
209209
// UniversalPrinter<absl::optional>
210210
// 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
211213
// GTEST_INTERNAL_HAS_STRING_VIEW - for enabling Matcher<std::string_view> or
212214
// Matcher<absl::string_view>
213215
// specializations. Always defined to 0 or 1.
@@ -609,7 +611,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
609611
// Determines whether clone(2) is supported.
610612
// Usually it will only be available on Linux, excluding
611613
// 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.
613615
#ifndef GTEST_HAS_CLONE
614616
// The user didn't tell us, so we need to figure it out.
615617

@@ -2407,6 +2409,16 @@ inline ::std::nullopt_t Nullopt() { return ::std::nullopt; }
24072409
#define GTEST_INTERNAL_HAS_OPTIONAL 0
24082410
#endif
24092411

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+
24102422
#ifdef GTEST_HAS_ABSL
24112423
// Always use absl::string_view for Matcher<> specializations if googletest
24122424
// is built with absl support.

deps/googletest/src/gtest-death-test.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() {
783783
StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) +
784784
// size_t has the same width as pointers on both 32-bit and 64-bit
785785
// Windows platforms.
786-
// See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.
786+
// See https://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx.
787787
"|" + StreamableToString(reinterpret_cast<size_t>(write_handle)) + "|" +
788788
StreamableToString(reinterpret_cast<size_t>(event_handle_.Get()));
789789

deps/googletest/src/gtest-internal-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ void ShuffleRange(internal::Random* random, int begin, int end,
312312
<< begin << ", " << size << "].";
313313

314314
// Fisher-Yates shuffle, from
315-
// http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
315+
// https://en.wikipedia.org/wiki/Fisher-Yates_shuffle
316316
for (int range_width = end - begin; range_width >= 2; range_width--) {
317317
const int last_in_range = begin + range_width - 1;
318318
const int selected =

deps/googletest/src/gtest.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ int UnitTestOptions::GTestProcessSEH(DWORD seh_code, const char* location) {
879879
// apparently).
880880
//
881881
// 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).
883883
const DWORD kCxxExceptionCode = 0xe06d7363;
884884

885885
if (!GTEST_FLAG_GET(catch_exceptions) || seh_code == kCxxExceptionCode ||
@@ -3228,7 +3228,8 @@ static const char* GetAnsiColorCode(GTestColor color) {
32283228
case GTestColor::kYellow:
32293229
return "3";
32303230
default:
3231-
return nullptr;
3231+
assert(false);
3232+
return "9";
32323233
}
32333234
}
32343235

doc/contributing/maintaining/maintaining-dependencies.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This a list of all the dependencies:
1515
* [c-ares 1.19.0][]
1616
* [cjs-module-lexer 1.2.2][]
1717
* [corepack][]
18-
* [googletest 7e33b6a][]
18+
* [googletest 8a6feab][]
1919
* [histogram 0.11.8][]
2020
* [icu-small 73.2][]
2121
* [libuv 1.46.0][]
@@ -189,7 +189,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to
189189
install them - just like what currently happens with npm, which is shipped
190190
by Node.js by default.
191191

192-
### googletest 7e33b6a
192+
### googletest 8a6feab
193193

194194
The [googletest](https://github.com/google/googletest) dependency is Google’s
195195
C++ testing and mocking framework.
@@ -326,7 +326,7 @@ performance improvements not currently available in standard zlib.
326326
[cjs-module-lexer 1.2.2]: #cjs-module-lexer-122
327327
[corepack]: #corepack
328328
[dependency-update-action]: ../../../.github/workflows/tools.yml
329-
[googletest 7e33b6a]: #googletest-7e33b6a
329+
[googletest 8a6feab]: #googletest-8a6feab
330330
[histogram 0.11.8]: #histogram-0118
331331
[icu-small 73.2]: #icu-small-732
332332
[libuv 1.46.0]: #libuv-1460

0 commit comments

Comments
 (0)