diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-04-13 14:12:54 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-04-13 14:12:54 +0000 |
| commit | 3e30eb9abe806a69e033e32d13a1986a42591f29 (patch) | |
| tree | 02f77f4db733776c058776c57b80a6a79fd5639d /src/cppunit/TextTestRunner.cpp | |
| parent | 8cabaebd9f8689ca96184daf415e3cc6cf67d722 (diff) | |
| download | cppunit-3e30eb9abe806a69e033e32d13a1986a42591f29.tar.gz | |
NEWS: updated
NEWS: updated
* doc/other_documentation.dox: addded new module for test plug-in.
* include/msvc6/DSPlugin/TestRunnerDSPlugin.h:
* include/msvc6/DSPlugin/TestRunnerDSPlugin_i.c: added. Those file are
generated by project src/msvc/DSPlugin. They are provided to allow
compilation of TestRunner without compiling DSPlugIn which does not
build on VC++ 7.
* examples/examples.dsw: removed DSPlugIn for workspace (fail to build
with VC++ 7). Added DllPlugInTester.dsp to workspace.
* examples/msvc6/TestPlugIn/TestPlugIn.dsp: added post-build unit testing
using the new DllPlugInTester.
* examples/msvc6/EasyTestPlugIn/*: a new project that
demonstrates the use of CPPUNIT_TESTPLUGIN_IMPL to create a test plug-in.
* src/cppunit/cppunit.dsw:
* src/TestPlugInRunner.dsw:
* src/TestRunner.dsw: removed. Should use src/CppUnitLibraries.dsw instead.
* include/cppunit/ui/text/TestRunner.h:
* src/cppunit/TextTestRunner.cpp: removed findTestName() method. Replaced
by Test::findTest().
* src/msvc6/DSPlugIn/DSPlugIn.dsp:
* src/msvc6/DSPlugIn/DSAddIn.h: changed include for add-in. MIDL generates
files in sub-directory ToAddToDistribution. Generated file should be
copied to include/msvc6/DSPlugin when modified. This remove the dependecy
of MfcTestRunner on DSPlugIn.
* src/msvc6/testrunner/ListCtrlFormatter.h:
* src/msvc6/testrunner/ListCtrlFormatter.cpp: added GetNextColumnIndex().
* src/msvc6/testrunner/src/TestRunnerDlg.h:
* src/msvc6/testrunner/src/TestRunnerDlg.cpp: set column number in
MsDevCallerListCtrl when initializing the list.
* src/msvc6/testrunner/src/MsDevCallerListCtrl.h:
* src/msvc6/testrunner/src/MsDevCallerListCtrl.cpp: column indexes for
file and line number are no longer static. Added methods to set those
indexes. Changed DSPlugIn header name.
* include/msvc6/testrunner/TestPlugInInterface.h: fixed inclusion of
windows header for WINAPI. Added macro CPPUNIT_TESTPLUGIN_IMPL to
automatically implements a test plug-in.
* src/msvc6/DllPlugInTester/*: added new project. A application to test DLL
and report using CompilerOutputter. Target for post-build testing and
debugging of DLL.
Diffstat (limited to 'src/cppunit/TextTestRunner.cpp')
| -rw-r--r-- | src/cppunit/TextTestRunner.cpp | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/src/cppunit/TextTestRunner.cpp b/src/cppunit/TextTestRunner.cpp index d190ebe..bf24dd4 100644 --- a/src/cppunit/TextTestRunner.cpp +++ b/src/cppunit/TextTestRunner.cpp @@ -51,8 +51,8 @@ TestRunner::addTest( Test *test ) /*! Runs the named test case. * * \param testName Name of the test case to run. If an empty is given, then - * all added test are run. The name must be the name of - * of an added test. + * all added tests are run. The name can be the name of any + * test in the hierarchy. * \param doWait if \c true then the user must press the RETURN key * before the run() method exit. * \param doPrintResult if \c true (default) then the test result are printed @@ -64,9 +64,9 @@ TestRunner::addTest( Test *test ) */ bool TestRunner::run( std::string testName, - bool doWait, - bool doPrintResult, - bool doPrintProgress ) + bool doWait, + bool doPrintResult, + bool doPrintProgress ) { runTestByName( testName, doPrintProgress ); printResult( doPrintResult ); @@ -77,16 +77,19 @@ TestRunner::run( std::string testName, bool TestRunner::runTestByName( std::string testName, - bool doPrintProgress ) + bool doPrintProgress ) { if ( testName.empty() ) return runTest( m_suite, doPrintProgress ); - Test *test = findTestByName( testName ); - if ( test != NULL ) - return runTest( test, doPrintProgress ); - - std::cout << "Test " << testName << " not found." << std::endl; + try + { + return runTest( m_suite->findTest( testName ), doPrintProgress ); + } + catch ( std::invalid_argument &) + { + std::cout << "Test " << testName << " not found." << std::endl; + } return false; } @@ -111,24 +114,9 @@ TestRunner::printResult( bool doPrintResult ) } -Test * -TestRunner::findTestByName( std::string name ) const -{ - for ( std::vector<Test *>::const_iterator it = m_suite->getTests().begin(); - it != m_suite->getTests().end(); - ++it ) - { - Test *test = *it; - if ( test->getName() == name ) - return test; - } - return NULL; -} - - bool TestRunner::runTest( Test *test, - bool doPrintProgress ) + bool doPrintProgress ) { TextTestProgressListener progress; if ( doPrintProgress ) |
