Index: runtime/platform/assert.h |
=================================================================== |
--- runtime/platform/assert.h (revision 8116) |
+++ runtime/platform/assert.h (working copy) |
@@ -52,6 +52,9 @@ |
void IsSubstring(const E& needle, const A& haystack); |
template<typename E, typename A> |
+ void IsNotSubstring(const E& needle, const A& haystack); |
+ |
+ template<typename E, typename A> |
void LessThan(const E& left, const A& right); |
template<typename E, typename A> |
@@ -158,6 +161,19 @@ |
template<typename E, typename A> |
+void DynamicAssertionHelper::IsNotSubstring(const E& needle, |
+ const A& haystack) { |
+ std::stringstream ess, ass; |
+ ess << needle; |
+ ass << haystack; |
+ std::string es = ess.str(), as = ass.str(); |
+ if (as.find(es) == std::string::npos) return; |
+ Fail("expected <\"%s\"> to not be a substring of <\"%s\">", |
+ es.c_str(), as.c_str()); |
+} |
+ |
+ |
+template<typename E, typename A> |
void DynamicAssertionHelper::LessThan(const E& left, const A& right) { |
if (left < right) return; |
std::stringstream ess, ass; |
@@ -276,6 +292,9 @@ |
#define EXPECT_SUBSTRING(needle, haystack) \ |
dart::Expect(__FILE__, __LINE__).IsSubstring((needle), (haystack)) |
+#define EXPECT_NOTSUBSTRING(needle, haystack) \ |
+ dart::Expect(__FILE__, __LINE__).IsNotSubstring((needle), (haystack)) |
+ |
#define EXPECT_LT(left, right) \ |
dart::Expect(__FILE__, __LINE__).LessThan((left), (right)) |