mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-22 08:02:06 +02:00
initial import
This commit is contained in:
92
CppUnit/include/CppUnit/TestFailure.h
Normal file
92
CppUnit/include/CppUnit/TestFailure.h
Normal file
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// TestFailure.h
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/include/CppUnit/TestFailure.h#1 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppUnit_TestFailure_INCLUDED
|
||||
#define CppUnit_TestFailure_INCLUDED
|
||||
|
||||
|
||||
#ifndef CppUnit_CppUnit_INCLUDED
|
||||
#include "CppUnit/CppUnit.h"
|
||||
#endif
|
||||
#ifndef CppUnit_CppUnitException_INCLUDED
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
#endif
|
||||
#ifndef CppUnit_Guards_INCLUDED
|
||||
#include "CppUnit/Guards.h"
|
||||
#endif
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
|
||||
|
||||
class Test;
|
||||
|
||||
|
||||
/*
|
||||
* A TestFailure collects a failed test together with
|
||||
* the caught exception.
|
||||
*
|
||||
* TestFailure assumes lifetime control for any exception
|
||||
* passed to it. The lifetime of tests is handled by
|
||||
* their TestSuite (if they have been added to one) or
|
||||
* whomever creates them.
|
||||
*
|
||||
* see TestResult
|
||||
* see TestSuite
|
||||
*
|
||||
*/
|
||||
class CppUnit_API TestFailure
|
||||
{
|
||||
REFERENCEOBJECT (TestFailure)
|
||||
|
||||
public:
|
||||
TestFailure(Test* failedTest, CppUnitException* thrownException);
|
||||
~TestFailure();
|
||||
|
||||
Test* failedTest();
|
||||
CppUnitException* thrownException();
|
||||
std::string toString();
|
||||
|
||||
protected:
|
||||
Test* _failedTest;
|
||||
CppUnitException *_thrownException;
|
||||
};
|
||||
|
||||
|
||||
// Constructs a TestFailure with the given test and exception.
|
||||
inline TestFailure::TestFailure(Test* failedTest, CppUnitException* thrownException): _failedTest(failedTest), _thrownException(thrownException)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Deletes the owned exception.
|
||||
inline TestFailure::~TestFailure()
|
||||
{
|
||||
delete _thrownException;
|
||||
}
|
||||
|
||||
|
||||
// Gets the failed test.
|
||||
inline Test* TestFailure::failedTest()
|
||||
{
|
||||
return _failedTest;
|
||||
}
|
||||
|
||||
|
||||
// Gets the thrown exception.
|
||||
inline CppUnitException* TestFailure::thrownException()
|
||||
{
|
||||
return _thrownException;
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
|
||||
|
||||
#endif // CppUnit_TestFailure_INCLUDED
|
||||
|
||||
|
Reference in New Issue
Block a user