46
46
47
47
#include " gtest/gtest-matchers.h"
48
48
#include " gtest/internal/gtest-internal.h"
49
+ #include " gtest/internal/gtest-port.h"
49
50
50
51
GTEST_DECLARE_string_ (internal_run_death_test);
51
52
@@ -55,6 +56,28 @@ namespace internal {
55
56
// Name of the flag (needed for parsing Google Test flag).
56
57
const char kInternalRunDeathTestFlag [] = " internal_run_death_test" ;
57
58
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
+
58
81
#ifdef GTEST_HAS_DEATH_TEST
59
82
60
83
GTEST_DISABLE_MSC_WARNINGS_PUSH_ (4251 \
@@ -168,28 +191,6 @@ class DefaultDeathTestFactory : public DeathTestFactory {
168
191
// by a signal, or exited normally with a nonzero exit code.
169
192
GTEST_API_ bool ExitedUnsuccessfully (int exit_status);
170
193
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
-
193
194
// Traps C++ exceptions escaping statement and reports them as test
194
195
// failures. Note that trapping SEH exceptions is not implemented here.
195
196
#if GTEST_HAS_EXCEPTIONS
0 commit comments