CppUnit project page | FAQ |
Outputs a TestResultCollector in a compiler compatible format.Printing the test results in a compiler compatible format (assertion location has the same format as compiler error), allow you to use your IDE to jump to the assertion failure. Location format can be customized (see setLocationFormat() ). More...
#include <CompilerOutputter.h>
Public Member Functions | |
CompilerOutputter (TestResultCollector *result, OStream &stream, const std::string &locationFormat=CPPUNIT_COMPILER_LOCATION_FORMAT) | |
Constructs a CompilerOutputter object. | |
virtual | ~CompilerOutputter () |
Destructor. | |
void | setLocationFormat (const std::string &locationFormat) |
Sets the error location format. | |
void | write () |
void | setNoWrap () |
void | setWrapColumn (int wrapColumn) |
int | wrapColumn () const |
virtual void | printSuccess () |
virtual void | printFailureReport () |
virtual void | printFailuresList () |
virtual void | printStatistics () |
virtual void | printFailureDetail (TestFailure *failure) |
virtual void | printFailureLocation (SourceLine sourceLine) |
virtual void | printFailureType (TestFailure *failure) |
virtual void | printFailedTestName (TestFailure *failure) |
virtual void | printFailureMessage (TestFailure *failure) |
Public Member Functions inherited from Outputter | |
virtual | ~Outputter () |
Destructor. |
Static Public Member Functions | |
static CompilerOutputter * | defaultOutputter (TestResultCollector *result, OStream &stream) |
Creates an instance of an outputter that matches your current compiler. |
Private Member Functions | |
CompilerOutputter (const CompilerOutputter ©) | |
Prevents the use of the copy constructor. | |
void | operator= (const CompilerOutputter ©) |
Prevents the use of the copy operator. | |
virtual bool | processLocationFormatCommand (char command, const SourceLine &sourceLine) |
virtual std::string | extractBaseName (const std::string &fileName) const |
Private Attributes | |
TestResultCollector * | m_result |
OStream & | m_stream |
std::string | m_locationFormat |
int | m_wrapColumn |
Outputs a TestResultCollector in a compiler compatible format.
Printing the test results in a compiler compatible format (assertion location has the same format as compiler error), allow you to use your IDE to jump to the assertion failure. Location format can be customized (see setLocationFormat() ).
For example, when running the test in a post-build with VC++, if an assertion fails, you can jump to the assertion by pressing F4 (jump to next error).
Heres is an example of usage (from examples/cppunittest/CppUnitTestMain.cpp):
CPPUNIT_NS_BEGIN CompilerOutputter::CompilerOutputter | ( | TestResultCollector * | result, |
OStream & | stream, | ||
const std::string & | locationFormat = CPPUNIT_COMPILER_LOCATION_FORMAT |
||
) |
Constructs a CompilerOutputter object.
result | Result of the test run. |
stream | Stream used to output test result. |
locationFormat | Error location format used by your compiler. Default to CPPUNIT_COMPILER_LOCATION_FORMAT which is defined in the configuration file. See setLocationFormat() for detail. |
|
virtual |
Destructor.
|
private |
Prevents the use of the copy constructor.
|
static |
Creates an instance of an outputter that matches your current compiler.
|
privatevirtual |
|
private |
Prevents the use of the copy operator.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
privatevirtual |
void CompilerOutputter::setLocationFormat | ( | const std::string & | locationFormat | ) |
Sets the error location format.
Indicates the format used to report location of failed assertion. This format should match the one used by your compiler.
The location format is a string in which the occurence of the following character sequence are replaced:
Some examples:
Thoses are the two compilers currently supported (gcc format is used if VC++ is not detected). If you want your compiler to be automatically supported by CppUnit, send a mail to the mailing list (preferred), or submit a feature request that indicates how to detect your compiler with the preprocessor (#ifdef...) and your compiler location format.
void CompilerOutputter::setNoWrap | ( | ) |
void CompilerOutputter::setWrapColumn | ( | int | wrapColumn | ) |
int CompilerOutputter::wrapColumn | ( | ) | const |
|
virtual |
Implements Outputter.
|
private |
|
private |
|
private |
|
private |
Send comments to: CppUnit Developers |