deps: update googletest to cd8e73f067129f8489e35c7b51c7a68552b289d2

PR-URL: https://github.com/nodejs/node/pull/66814
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
This commit is contained in:
Node.js GitHub Bot authored and GitHub committed 2026-10-25 11:56:04 +00:00
1 parent b41fabb13c
commit 3bc923a3e4
4 files changed
+92 -45

No files matched your search

+23 -18
View File
@@ -256,8 +256,11 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
// The variables defined in the type-parameterized test macros are
// static as typically these macros are used in a .h file that can be
// #included in multiple translation units linked together.
#define TYPED_TEST_SUITE_P(SuiteName) \
static ::testing::internal::TypedTestSuitePState \
// Marked [[maybe_unused]] because TypedTestSuitePState is
// constexpr-constructible and trivially destructible, so an uninstantiated
// suite would otherwise trigger -Wunused-variable.
#define TYPED_TEST_SUITE_P(SuiteName) \
[[maybe_unused]] static ::testing::internal::TypedTestSuitePState \
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName)
// Legacy API is deprecated but still available
@@ -267,22 +270,24 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
TYPED_TEST_SUITE_P
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
#define TYPED_TEST_P(SuiteName, TestName) \
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
template <typename gtest_TypeParam_> \
class TestName : public SuiteName<gtest_TypeParam_> { \
private: \
typedef SuiteName<gtest_TypeParam_> TestFixture; \
typedef gtest_TypeParam_ TypeParam; \
void TestBody() override; \
}; \
[[maybe_unused]] static bool gtest_##TestName##_defined_ = \
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
__FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
GTEST_STRINGIFY_(TestName)); \
} \
template <typename gtest_TypeParam_> \
void GTEST_SUITE_NAMESPACE_( \
#define TYPED_TEST_P(SuiteName, TestName) \
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
template <typename gtest_TypeParam_> \
class TestName : public SuiteName<gtest_TypeParam_> { \
private: \
typedef SuiteName<gtest_TypeParam_> TestFixture; \
typedef gtest_TypeParam_ TypeParam; \
void TestBody() override; \
}; \
static ::testing::internal::TypedTestSuitePState::RegisteredTest \
gtest_##TestName##_registered_test_ = {GTEST_STRINGIFY_(TestName), \
__FILE__, __LINE__, nullptr}; \
[[maybe_unused]] static bool gtest_##TestName##_defined_ = \
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTest( \
&gtest_##TestName##_registered_test_, GTEST_STRINGIFY_(SuiteName)); \
} \
template <typename gtest_TypeParam_> \
void GTEST_SUITE_NAMESPACE_( \
SuiteName)::TestName<gtest_TypeParam_>::TestBody()
// Note: this won't work correctly if the trailing arguments are macros.
+53 -17
View File
@@ -577,51 +577,87 @@ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
// State of the definition of a type-parameterized test suite.
// Uses an intrusive linked list of caller-allocated POD RegisteredTest nodes
// rather than an STL container.
// REQUIRES: TypedTestSuitePState must be constexpr-constructible and trivially
// destructible so that namespace-scope static instances defined by
// TYPED_TEST_SUITE_P avoid -Wglobal-constructors and -Wexit-time-destructors.
class GTEST_API_ [[nodiscard]] TypedTestSuitePState {
public:
TypedTestSuitePState() : registered_(false) {}
// Caller-owned POD node linked into registered_tests_; must outlive this
// TypedTestSuitePState instance.
struct RegisteredTest {
const char* name;
const char* file;
int line;
RegisteredTest* next;
};
// Adds the given test name to defined_test_names_ and return true
// if the test suite hasn't been registered; otherwise aborts the
// program.
bool AddTestName(const char* file, int line, const char* case_name,
const char* test_name) {
constexpr TypedTestSuitePState() = default;
// Adds the given test to registered_tests_ and returns true if the test
// suite hasn't been registered; otherwise aborts the program.
bool AddTest(RegisteredTest* test, const char* case_name) {
if (registered_) {
fprintf(stderr,
"%s Test %s must be defined before "
"REGISTER_TYPED_TEST_SUITE_P(%s, ...).\n",
FormatFileLocation(file, line).c_str(), test_name, case_name);
FormatFileLocation(test->file, test->line).c_str(), test->name,
case_name);
fflush(stderr);
posix::Abort();
}
registered_tests_.emplace(test_name, CodeLocation(file, line));
// Insert into registered_tests_ in lexicographical order by test name
// (ignoring duplicates) so VerifyRegisteredTestNames reports missing tests
// in deterministic sorted order.
RegisteredTest** p = &registered_tests_;
while (*p != nullptr && strcmp((*p)->name, test->name) < 0) {
p = &(*p)->next;
}
if (*p == nullptr || strcmp((*p)->name, test->name) != 0) {
test->next = *p;
*p = test;
}
return true;
}
bool TestExists(const std::string& test_name) const {
return registered_tests_.count(test_name) > 0;
return FindTest(test_name) != nullptr;
}
const CodeLocation& GetCodeLocation(const std::string& test_name) const {
RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
GTEST_CHECK_(it != registered_tests_.end());
return it->second;
CodeLocation GetCodeLocation(const std::string& test_name) const {
const RegisteredTest* test = FindTest(test_name);
GTEST_CHECK_(test != nullptr);
return CodeLocation(test->file, test->line);
}
// Verifies that registered_tests match the test names in
// defined_test_names_; returns registered_tests if successful, or
// registered_tests_; returns registered_tests if successful, or
// aborts the program otherwise.
const char* VerifyRegisteredTestNames(const char* test_suite_name,
const char* file, int line,
const char* registered_tests);
private:
typedef ::std::map<std::string, CodeLocation, std::less<>> RegisteredTestsMap;
const RegisteredTest* FindTest(const std::string& test_name) const {
for (const RegisteredTest* it = registered_tests_; it != nullptr;
it = it->next) {
if (test_name == it->name) {
return it;
}
}
return nullptr;
}
bool registered_;
RegisteredTestsMap registered_tests_;
bool registered_ = false;
RegisteredTest* registered_tests_ = nullptr;
};
static_assert((static_cast<void>(TypedTestSuitePState{}), true),
"TypedTestSuitePState must be constexpr-constructible");
static_assert(std::is_trivially_destructible_v<TypedTestSuitePState>,
"TypedTestSuitePState must be trivially destructible");
// Legacy API is deprecated but still available
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
using TypedTestCasePState = TypedTestSuitePState;
+5 -6
View File
@@ -62,7 +62,6 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
const char* registered_tests) {
RegisterTypeParameterizedTestSuite(test_suite_name, CodeLocation(file, line));
typedef RegisteredTestsMap::const_iterator RegisteredTestIter;
registered_ = true;
std::vector<std::string> name_vec = SplitIntoTestNames(registered_tests);
@@ -78,7 +77,7 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
continue;
}
if (registered_tests_.count(name) != 0) {
if (TestExists(name)) {
tests.insert(name);
} else {
errors << "No test named " << name
@@ -86,10 +85,10 @@ const char* TypedTestSuitePState::VerifyRegisteredTestNames(
}
}
for (RegisteredTestIter it = registered_tests_.begin();
it != registered_tests_.end(); ++it) {
if (tests.count(it->first) == 0) {
errors << "You forgot to list test " << it->first << ".\n";
for (const RegisteredTest* it = registered_tests_; it != nullptr;
it = it->next) {
if (tests.count(it->name) == 0) {
errors << "You forgot to list test " << it->name << ".\n";
}
}
+11 -4
View File
@@ -6857,6 +6857,16 @@ static void LoadFlagsFromFile(const std::string& path) {
if (!ParseGoogleTestFlag(lines[i].c_str())) g_help_flag = true;
}
}
static bool ParseFlagFileFlag(const char* const arg) {
std::string flagfile_value;
if (!ParseFlag(arg, "flagfile", &flagfile_value)) {
return false;
}
GTEST_FLAG_SET(flagfile, flagfile_value);
LoadFlagsFromFile(flagfile_value);
return true;
}
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ && GTEST_HAS_FILE_SYSTEM
// Parses the command line for Google Test flags, without initializing
@@ -6864,7 +6874,6 @@ static void LoadFlagsFromFile(const std::string& path) {
// instantiated to either char or wchar_t.
template <typename CharType>
void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
std::string flagfile_value;
for (int i = 1; i < *argc; i++) {
const std::string arg_string = StreamableToString(argv[i]);
const char* const arg = arg_string.c_str();
@@ -6875,9 +6884,7 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
if (ParseGoogleTestFlag(arg)) {
remove_flag = true;
#if GTEST_USE_OWN_FLAGFILE_FLAG_ && GTEST_HAS_FILE_SYSTEM
} else if (ParseFlag(arg, "flagfile", &flagfile_value)) {
GTEST_FLAG_SET(flagfile, flagfile_value);
LoadFlagsFromFile(flagfile_value);
} else if (ParseFlagFileFlag(arg)) {
remove_flag = true;
#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ && GTEST_HAS_FILE_SYSTEM
} else if (arg_string == "--help" || HasGoogleTestFlagPrefix(arg)) {