@@ -1876,11 +1876,13 @@ bool IsSubstringPred(const char* needle, const char* haystack) {
18761876 return strstr (haystack, needle) != nullptr ;
18771877}
18781878
1879+ #if GTEST_HAS_STD_WSTRING
18791880bool IsSubstringPred (const wchar_t * needle, const wchar_t * haystack) {
18801881 if (needle == nullptr || haystack == nullptr ) return needle == haystack;
18811882
18821883 return wcsstr (haystack, needle) != nullptr ;
18831884}
1885+ #endif // GTEST_HAS_STD_WSTRING
18841886
18851887// StringType here can be either ::std::string or ::std::wstring.
18861888template <typename StringType>
@@ -1922,23 +1924,12 @@ AssertionResult IsSubstring(const char* needle_expr, const char* haystack_expr,
19221924 return IsSubstringImpl (true , needle_expr, haystack_expr, needle, haystack);
19231925}
19241926
1925- AssertionResult IsSubstring (const char * needle_expr, const char * haystack_expr,
1926- const wchar_t * needle, const wchar_t * haystack) {
1927- return IsSubstringImpl (true , needle_expr, haystack_expr, needle, haystack);
1928- }
1929-
19301927AssertionResult IsNotSubstring (const char * needle_expr,
19311928 const char * haystack_expr, const char * needle,
19321929 const char * haystack) {
19331930 return IsSubstringImpl (false , needle_expr, haystack_expr, needle, haystack);
19341931}
19351932
1936- AssertionResult IsNotSubstring (const char * needle_expr,
1937- const char * haystack_expr, const wchar_t * needle,
1938- const wchar_t * haystack) {
1939- return IsSubstringImpl (false , needle_expr, haystack_expr, needle, haystack);
1940- }
1941-
19421933AssertionResult IsSubstring (const char * needle_expr, const char * haystack_expr,
19431934 const ::std::string& needle,
19441935 const ::std::string& haystack) {
@@ -1953,6 +1944,17 @@ AssertionResult IsNotSubstring(const char* needle_expr,
19531944}
19541945
19551946#if GTEST_HAS_STD_WSTRING
1947+ AssertionResult IsSubstring (const char * needle_expr, const char * haystack_expr,
1948+ const wchar_t * needle, const wchar_t * haystack) {
1949+ return IsSubstringImpl (true , needle_expr, haystack_expr, needle, haystack);
1950+ }
1951+
1952+ AssertionResult IsNotSubstring (const char * needle_expr,
1953+ const char * haystack_expr, const wchar_t * needle,
1954+ const wchar_t * haystack) {
1955+ return IsSubstringImpl (false , needle_expr, haystack_expr, needle, haystack);
1956+ }
1957+
19561958AssertionResult IsSubstring (const char * needle_expr, const char * haystack_expr,
19571959 const ::std::wstring& needle,
19581960 const ::std::wstring& haystack) {
@@ -2182,6 +2184,7 @@ bool String::WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs) {
21822184 return wcscmp (lhs, rhs) == 0 ;
21832185}
21842186
2187+ #if GTEST_HAS_STD_WSTRING
21852188// Helper function for *_STREQ on wide strings.
21862189AssertionResult CmpHelperSTREQ (const char * lhs_expression,
21872190 const char * rhs_expression, const wchar_t * lhs,
@@ -2206,6 +2209,7 @@ AssertionResult CmpHelperSTRNE(const char* s1_expression,
22062209 << " Expected: (" << s1_expression << " ) != (" << s2_expression
22072210 << " ), actual: " << PrintToString (s1) << " vs " << PrintToString (s2);
22082211}
2212+ #endif // GTEST_HAS_STD_WSTRING
22092213
22102214// Compares two C strings, ignoring case. Returns true if and only if they have
22112215// the same content.
0 commit comments