summaryrefslogtreecommitdiff
path: root/src/cppunit/TestFailure.cpp
blob: 6a4869604ec4b6eaeb3e8bf10b753732daa518b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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