summaryrefslogtreecommitdiff
path: root/include/cppunit/CompilerOutputter.h
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-03-28 14:50:09 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-03-28 14:50:09 +0000
commit82d51cba4c7cc8d756ab14fdfc28181f007f3848 (patch)
treed28a09b421cb1802e5720cd112a577958b2c9d0f /include/cppunit/CompilerOutputter.h
parent686e4865001cb14c36e8e3e81fc7c57786ff0542 (diff)
downloadcppunit-82d51cba4c7cc8d756ab14fdfc28181f007f3848.tar.gz
Doc/cookbook.
doc/cookbook.html: removed. Replaced by cookbook.doc. * doc/cookbook.dox: added, conversion of cookbook.html to Doxygen format. * doc/other_documentation.dox: added groups definition. * doc/Makefile.am: replaced cookbook.html by cookbook.dox * doc/Doxyfile.in: added predefined CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION. Replaced cookbook.html by cookbook.dox. * include/cppunitui/mfc/TestRunner.h: added, extracted from include/msvc6/testrunner/TestRunner.h. Moved class TestRunner to namespace CppUnit::MfcUi. * include/msvc6/testrunner/TestRunner.h: deprecated. A simple typedef to CppUnit::MfcUi::TestRunner. * include/textui/TestRuner.h: added, extracted from include/cppunit/TextTestRunner.h. * src/cppunit/TextTestRunner.cpp: renamed TestRunner.cpp. Moved into namespace CppUnit::TextUi. * src/msvc6/testruner/TestRunner.cpp: moved into namespace CppUnit::MfcUi. * src/cppunit/CompilerOutputter.cpp: removed printing "- " before NotEqualException addional message, for consistency between different TestRunner (Mfc,Text...) * include/cppunit/Asserter.h: * include/cppunit/CompilerOutputter.h: * include/cppunit/Exception.h: * include/cppunit/NotEqualException.h: * include/cppunit/Outputter.h: * include/cppunit/SourceLine.h: * include/cppunit/TestAssert.h: * include/cppunit/TestCaller.h: * include/cppunit/TestFailure.h: * include/cppunit/TestFixture.h: * include/cppunit/TestListener.h: * include/cppunit/TestResult.h: * include/cppunit/TestResultCollector.h: * include/cppunit/TestSucessListener.h: * include/cppunit/TestSuite.h: * include/cppunit/TextTestProgressListener.h: * include/cppunit/TextTestRunner.h: * include/cppunit/XmlOutputter.h: * include/cppunit/extensions/AutoRegisterSuite.h: * include/cppunit/extensions/HelperMacros.h: * include/cppunit/extensions/TestFactoryRegistry.h: * include/cppunit/extensions/TestSuiteBuilder.h: * include/cppunit/extensions/TestSuiteFactory.h: doc update. organization in groups. * examples/msvc6/CppUnitTestApp/CppUnitTestApp.cpp: * examples/msvc6/HostApp/HostApp.cpp: updated to use CppUnit::MfcUi::TestRunner. * examples/cppunittest/CppUnitTestMain.cpp: updated to use CppUnit::TextUi::TestRunner.
Diffstat (limited to 'include/cppunit/CompilerOutputter.h')
-rw-r--r--include/cppunit/CompilerOutputter.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/include/cppunit/CompilerOutputter.h b/include/cppunit/CompilerOutputter.h
index 73176ff..0075972 100644
--- a/include/cppunit/CompilerOutputter.h
+++ b/include/cppunit/CompilerOutputter.h
@@ -16,7 +16,44 @@ class TestFailure;
class TestResultCollector;
/*!
- * \brief Outputs test results in a compiler compatible format.
+ * \brief Outputs a TestResultCollector in a compiler compatible format.
+ * \ingroup WritingTestResult
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * You should use defaultOutputter() to create an instance.
+ *
+ * Heres is an example of usage (from examples/cppunittest/CppUnitTestMain.cpp):
+ * \code
+ * int main( int argc, char* argv[] ) {
+ * // if command line contains "-selftest" then this is the post build check
+ * // => the output must be in the compiler error format.
+ * bool selfTest = (argc > 1) &&
+ * (std::string("-selftest") == argv[1]);
+ *
+ * CppUnit::TextUi::TestRunner runner;
+ * runner.addTest( CppUnitTest::suite() ); // Add the top suite to the test runner
+ *
+ * if ( selfTest )
+ * { // Change the default outputter to a compiler error format outputter
+ * // The test runner owns the new outputter.
+ * runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter(
+ * &runner.result(),
+ * std::cerr ) );
+ * }
+ *
+ * // Run the test and don't wait a key if post build check.
+ * bool wasSucessful = runner.run( "", !selfTest );
+ *
+ * // Return error code 1 if the one of test failed.
+ * return wasSucessful ? 0 : 1;
+ * }
+ * \endcode
*/
class CPPUNIT_API CompilerOutputter : public Outputter
{
@@ -29,6 +66,8 @@ public:
/// Destructor.
virtual ~CompilerOutputter();
+ /*! Creates an instance of an outputter that matches your current compiler.
+ */
static CompilerOutputter *defaultOutputter( TestResultCollector *result,
std::ostream &stream );