diff options
Diffstat (limited to 'src/cppunit')
| -rw-r--r-- | src/cppunit/TextTestRunner.cpp | 42 | ||||
| -rw-r--r-- | src/cppunit/cppunit.dsw | 29 |
2 files changed, 15 insertions, 56 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 ) diff --git a/src/cppunit/cppunit.dsw b/src/cppunit/cppunit.dsw deleted file mode 100644 index 0c89c6c..0000000 --- a/src/cppunit/cppunit.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "cppunit"=".\cppunit.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - |
