| 1258 | // or ::std::wstring. |
| 1259 | template <typename StringType> |
| 1260 | AssertionResult IsSubstringImpl( |
| 1261 | bool expected_to_be_substring, |
| 1262 | const char* needle_expr, const char* haystack_expr, |
| 1263 | const StringType& needle, const StringType& haystack) { |
| 1264 | if (IsSubstringPred(needle, haystack) == expected_to_be_substring) |
| 1265 | return AssertionSuccess(); |
| 1266 | |
| 1267 | const bool is_wide_string = sizeof(needle[0]) > 1; |
| 1268 | const char* const begin_string_quote = is_wide_string ? "L\"" : "\""; |
| 1269 | return AssertionFailure() |
| 1270 | << "Value of: " << needle_expr << "\n" |
| 1271 | << " Actual: " << begin_string_quote << needle << "\"\n" |
| 1272 | << "Expected: " << (expected_to_be_substring ? "" : "not ") |
| 1273 | << "a substring of " << haystack_expr << "\n" |
| 1274 | << "Which is: " << begin_string_quote << haystack << "\""; |
| 1275 | } |
| 1276 | |
| 1277 | } // namespace |
| 1278 |
no test coverage detected