Skip to content

Commit b4e148c

Browse files
deps: update googletest to 33af80a
PR-URL: #53053 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]>
1 parent 786cb42 commit b4e148c

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

deps/googletest/include/gtest/gtest-death-test.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ class GTEST_API_ KilledBySignal {
293293
// statement is compiled but not executed, to ensure that
294294
// EXPECT_DEATH_IF_SUPPORTED compiles with a certain
295295
// parameter if and only if EXPECT_DEATH compiles with it.
296-
// regex - A regex that a macro such as EXPECT_DEATH would use to test
297-
// the output of statement. This parameter has to be
296+
// regex_or_matcher - A regex that a macro such as EXPECT_DEATH would use
297+
// to test the output of statement. This parameter has to be
298298
// compiled but not evaluated by this macro, to ensure that
299299
// this macro only accepts expressions that a macro such as
300300
// EXPECT_DEATH would accept.
@@ -311,13 +311,13 @@ class GTEST_API_ KilledBySignal {
311311
// statement unconditionally returns or throws. The Message constructor at
312312
// the end allows the syntax of streaming additional messages into the
313313
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
314-
#define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
314+
#define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex_or_matcher, terminator) \
315315
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
316316
if (::testing::internal::AlwaysTrue()) { \
317317
GTEST_LOG_(WARNING) << "Death tests are not supported on this platform.\n" \
318318
<< "Statement '" #statement "' cannot be verified."; \
319319
} else if (::testing::internal::AlwaysFalse()) { \
320-
::testing::internal::RE::PartialMatch(".*", (regex)); \
320+
::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \
321321
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
322322
terminator; \
323323
} else \

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

+23-22
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
#include "gtest/gtest-matchers.h"
4848
#include "gtest/internal/gtest-internal.h"
49+
#include "gtest/internal/gtest-port.h"
4950

5051
GTEST_DECLARE_string_(internal_run_death_test);
5152

@@ -55,6 +56,28 @@ namespace internal {
5556
// Name of the flag (needed for parsing Google Test flag).
5657
const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
5758

59+
// A string passed to EXPECT_DEATH (etc.) is caught by one of these overloads
60+
// and interpreted as a regex (rather than an Eq matcher) for legacy
61+
// compatibility.
62+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
63+
::testing::internal::RE regex) {
64+
return ContainsRegex(regex.pattern());
65+
}
66+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(const char* regex) {
67+
return ContainsRegex(regex);
68+
}
69+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
70+
const ::std::string& regex) {
71+
return ContainsRegex(regex);
72+
}
73+
74+
// If a Matcher<const ::std::string&> is passed to EXPECT_DEATH (etc.), it's
75+
// used directly.
76+
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
77+
Matcher<const ::std::string&> matcher) {
78+
return matcher;
79+
}
80+
5881
#ifdef GTEST_HAS_DEATH_TEST
5982

6083
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
@@ -168,28 +191,6 @@ class DefaultDeathTestFactory : public DeathTestFactory {
168191
// by a signal, or exited normally with a nonzero exit code.
169192
GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
170193

171-
// A string passed to EXPECT_DEATH (etc.) is caught by one of these overloads
172-
// and interpreted as a regex (rather than an Eq matcher) for legacy
173-
// compatibility.
174-
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
175-
::testing::internal::RE regex) {
176-
return ContainsRegex(regex.pattern());
177-
}
178-
inline Matcher<const ::std::string&> MakeDeathTestMatcher(const char* regex) {
179-
return ContainsRegex(regex);
180-
}
181-
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
182-
const ::std::string& regex) {
183-
return ContainsRegex(regex);
184-
}
185-
186-
// If a Matcher<const ::std::string&> is passed to EXPECT_DEATH (etc.), it's
187-
// used directly.
188-
inline Matcher<const ::std::string&> MakeDeathTestMatcher(
189-
Matcher<const ::std::string&> matcher) {
190-
return matcher;
191-
}
192-
193194
// Traps C++ exceptions escaping statement and reports them as test
194195
// failures. Note that trapping SEH exceptions is not implemented here.
195196
#if GTEST_HAS_EXCEPTIONS

0 commit comments

Comments
 (0)