summaryrefslogtreecommitdiff
path: root/src/cppunit/TestFailure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cppunit/TestFailure.cpp')
-rw-r--r--src/cppunit/TestFailure.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/cppunit/TestFailure.cpp b/src/cppunit/TestFailure.cpp
new file mode 100644
index 0000000..6a48696
--- /dev/null
+++ b/src/cppunit/TestFailure.cpp
@@ -0,0 +1,26 @@
+#include "cppunit/TestFailure.h"
+#include "cppunit/Exception.h"
+#include "cppunit/Test.h"
+
+namespace CppUnit {
+
+/// Returns a short description of the failure.
+std::string
+TestFailure::toString () const
+{
+ return m_failedTest->toString () + ": " + m_thrownException->what ();
+}
+
+/// Constructs a TestFailure with the given test and exception.
+TestFailure::TestFailure (Test *failedTest, Exception *thrownException)
+ : m_failedTest (failedTest), m_thrownException (thrownException)
+{
+}
+
+/// Deletes the owned exception.
+TestFailure::~TestFailure ()
+{
+ delete m_thrownException;
+}
+
+} // namespace CppUnit