Enables regex matchers on all platforms.

This commit is contained in:
zhanyong.wan
2010-01-14 05:36:32 +00:00
parent 6953a725fc
commit d14aaed74b
5 changed files with 18 additions and 52 deletions

View File

@@ -1117,8 +1117,6 @@ bool MatchAndExplain(const EndsWithMatcher<StringType>& impl, T& s,
return impl.Matches(s);
}
#if GMOCK_HAS_REGEX
// Implements polymorphic matchers MatchesRegex(regex) and
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
// T can be converted to a string.
@@ -1165,8 +1163,6 @@ bool MatchAndExplain(const MatchesRegexMatcher& impl, T& s,
return impl.Matches(s);
}
#endif // GMOCK_HAS_REGEX
// Implements a matcher that compares the two fields of a 2-tuple
// using one of the ==, <=, <, etc, operators. The two fields being
// compared don't have to have the same type.
@@ -2718,8 +2714,6 @@ inline PolymorphicMatcher<internal::EndsWithMatcher<internal::string> >
suffix));
}
#ifdef GMOCK_HAS_REGEX
// Matches a string that fully matches regular expression 'regex'.
// The matcher takes ownership of 'regex'.
inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
@@ -2742,8 +2736,6 @@ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
return ContainsRegex(new internal::RE(regex));
}
#endif // GMOCK_HAS_REGEX
#if GTEST_HAS_GLOBAL_WSTRING || GTEST_HAS_STD_WSTRING
// Wide string matchers.

View File

@@ -52,26 +52,8 @@
#if GTEST_OS_LINUX
// On some platforms, <regex.h> needs someone to define size_t, and
// won't compile otherwise. We can #include it here as we already
// included <stdlib.h>, which is guaranteed to define size_t through
// <stddef.h>.
#include <regex.h> // NOLINT
// Defines this iff Google Mock uses the enhanced POSIX regular
// expression syntax. This is public as it affects how a user uses
// regular expression matchers.
#define GMOCK_USES_POSIX_RE 1
#endif // GTEST_OS_LINUX
#if defined(GMOCK_USES_PCRE) || defined(GMOCK_USES_POSIX_RE)
// Defines this iff regular expression matchers are supported. This
// is public as it tells a user whether he can use regular expression
// matchers.
#define GMOCK_HAS_REGEX 1
#endif // defined(GMOCK_USES_PCRE) || defined(GMOCK_USES_POSIX_RE)
namespace testing {
namespace internal {