From d0d4670f4941dcf7430fb1269c6613140ecf3ff7 Mon Sep 17 00:00:00 2001 From: Mark Lentczner Date: Tue, 6 Feb 2007 00:57:33 +0000 Subject: merge in of error-refactor-3 concludes (fixes) SL-31187 pair programmed and reviewed by markl and karen --- indra/test/lltut.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'indra/test/lltut.cpp') 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()); + } + } } -- cgit v1.3