summaryrefslogtreecommitdiff
path: root/indra/test
diff options
context:
space:
mode:
authorMark Lentczner <markl@lindenlab.com>2007-02-06 00:57:33 +0000
committerMark Lentczner <markl@lindenlab.com>2007-02-06 00:57:33 +0000
commitd0d4670f4941dcf7430fb1269c6613140ecf3ff7 (patch)
treee3d6b59c19cac6bc172ec5fb0131ffc8f4923b75 /indra/test
parent77f04c74eb1603bf2fadc30127d05378bfc7a48a (diff)
merge in of error-refactor-3
concludes (fixes) SL-31187 pair programmed and reviewed by markl and karen
Diffstat (limited to 'indra/test')
-rw-r--r--indra/test/llhttpclient_tut.cpp1
-rw-r--r--indra/test/llpipeutil.cpp1
-rw-r--r--indra/test/lltut.cpp28
-rw-r--r--indra/test/lltut.h6
-rw-r--r--indra/test/test.cpp11
5 files changed, 47 insertions, 0 deletions
diff --git a/indra/test/llhttpclient_tut.cpp b/indra/test/llhttpclient_tut.cpp
index 98f24c1bdd..40cde1fd6c 100644
--- a/indra/test/llhttpclient_tut.cpp
+++ b/indra/test/llhttpclient_tut.cpp
@@ -16,6 +16,7 @@
#include "lltut.h"
#include "llhttpclient.h"
+#include "llformat.h"
#include "llpipeutil.h"
#include "llpumpio.h"
diff --git a/indra/test/llpipeutil.cpp b/indra/test/llpipeutil.cpp
index 56789cfae8..3a15bfdb7e 100644
--- a/indra/test/llpipeutil.cpp
+++ b/indra/test/llpipeutil.cpp
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include "llbufferstream.h"
+#include "lldefs.h"
#include "llframetimer.h"
#include "llpumpio.h"
#include "llrand.h"
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());
+ }
+ }
}
diff --git a/indra/test/lltut.h b/indra/test/lltut.h
index c750a99b8d..c2ec504857 100644
--- a/indra/test/lltut.h
+++ b/indra/test/lltut.h
@@ -68,8 +68,14 @@ namespace tut
void ensure_starts_with(const std::string& msg,
const std::string& actual, const std::string& expectedStart);
+ void ensure_ends_with(const std::string& msg,
+ const std::string& actual, const std::string& expectedEnd);
+
void ensure_contains(const std::string& msg,
const std::string& actual, const std::string& expectedSubString);
+
+ void ensure_does_not_contain(const std::string& msg,
+ const std::string& actual, const std::string& expectedSubString);
}
diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 2d727daaa5..312c52dc77 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -17,6 +17,7 @@
*/
#include "linden_common.h"
+#include "llerrorcontrol.h"
#include "lltut.h"
#include <apr-1/apr_pools.h>
@@ -159,8 +160,18 @@ void stream_groups(std::ostream& s, const char* app)
}
}
+void wouldHaveCrashed(const std::string& message)
+{
+ tut::fail("llerrs message: " + message);
+}
+
int main(int argc, char **argv)
{
+ LLError::initForApplication(".");
+ LLError::setFatalFunction(wouldHaveCrashed);
+ LLError::setDefaultLevel(LLError::LEVEL_ERROR);
+ // *FIX: should come from error config file
+
#ifdef CTYPE_WORKAROUND
ctype_workaround();
#endif