summaryrefslogtreecommitdiff
path: root/indra/test/lltut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/test/lltut.cpp')
-rw-r--r--indra/test/lltut.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/indra/test/lltut.cpp b/indra/test/lltut.cpp
index 96aad3da58..592d61137d 100644
--- a/indra/test/lltut.cpp
+++ b/indra/test/lltut.cpp
@@ -9,6 +9,8 @@
*/
#include "lltut.h"
+
+#include "llformat.h"
#include "llsd.h"
namespace tut
@@ -135,6 +137,20 @@ namespace tut
}
}
+ void ensure_ends_with(const std::string& msg,
+ const std::string& actual, const std::string& expectedEnd)
+ {
+ if( actual.size() < expectedEnd.size()
+ || actual.rfind(expectedEnd)
+ != (actual.size() - expectedEnd.size()) )
+ {
+ std::stringstream ss;
+ ss << msg << ": " << "expected to find " << expectedEnd
+ << " at end of actual " << actual;
+ throw failure(ss.str().c_str());
+ }
+ }
+
void ensure_contains(const std::string& msg,
const std::string& actual, const std::string& expectedSubString)
{
@@ -146,4 +162,16 @@ namespace tut
throw failure(ss.str().c_str());
}
}
+
+ void ensure_does_not_contain(const std::string& msg,
+ const std::string& actual, const std::string& expectedSubString)
+ {
+ if( actual.find(expectedSubString, 0) != std::string::npos )
+ {
+ std::stringstream ss;
+ ss << msg << ": " << "expected not to find " << expectedSubString
+ << " in actual " << actual;
+ throw failure(ss.str().c_str());
+ }
+ }
}