Update of /cvsroot/cppunit/cppunit2/src/cpput
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23769/src/cpput
Modified Files:
lighttestrunner.cpp testinfo.cpp
Log Message:
* Added log support in test result output
* Removed unsued method in TestResultUpdater
* Added CppUT::log demo example.
Index: lighttestrunner.cpp
===================================================================
RCS file: /cvsroot/cppunit/cppunit2/src/cpput/lighttestrunner.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** lighttestrunner.cpp 10 Aug 2005 21:34:29 -0000 1.7
--- lighttestrunner.cpp 11 Aug 2005 07:18:24 -0000 1.8
***************
*** 74,77 ****
--- 74,79 ----
printf( "Testing %s : ", getTestPath().c_str() );
assertions_.clear();
+ logs_.clear();
+ results_.clear();
++testRun_;
bool succeeded = testCase->runTest();
***************
*** 85,91 ****
: "assertion";
report_ += "-> " + getTestPath() + " : " + resultType + "\n";
! Assertions::const_iterator it = assertions_.begin();
! for ( ; it != assertions_.end(); ++it )
! reportFailure( *it );
report_ += "\n";
}
--- 87,102 ----
: "assertion";
report_ += "-> " + getTestPath() + " : " + resultType + "\n";
! //Assertions::const_iterator it = assertions_.begin();
! //for ( ; it != assertions_.end(); ++it )
! // reportFailure( *it );
! ResultElements::const_iterator it = results_.begin();
! for ( ; it != results_.end(); ++it )
! {
! const ResultElement &result = *it;
! if ( result.isLog_ )
! reportLog( logs_[result.index_] );
! else
! reportFailure( assertions_[ result.index_ ] );
! }
report_ += "\n";
}
***************
*** 95,100 ****
LightTestRunner::addResultLog( const OpenTest::Value &log )
{
! // discard log for the time being. Need to incorporate them
! // into a single list with assertions.
}
--- 106,114 ----
LightTestRunner::addResultLog( const OpenTest::Value &log )
{
! ResultElement element;
! element.isLog_ = true;
! element.index_ = int(logs_.size());
! results_.push_back( element );
! logs_.push_back( log );
}
***************
*** 103,116 ****
LightTestRunner::addResultAssertion( const Assertion &assertion )
{
assertions_.push_back( assertion );
}
- void
- LightTestRunner::setTestStatus( const TestStatus &status )
- {
- }
-
-
CppTL::ConstString
LightTestRunner::getTestPath() const
--- 117,128 ----
LightTestRunner::addResultAssertion( const Assertion &assertion )
{
+ ResultElement element;
+ element.isLog_ = false;
+ element.index_ = int(assertions_.size());
+ results_.push_back( element );
assertions_.push_back( assertion );
}
CppTL::ConstString
LightTestRunner::getTestPath() const
***************
*** 149,152 ****
--- 161,177 ----
+ void
+ LightTestRunner::reportLog( const OpenTest::Value &log )
+ {
+ report_ += "Log:\n";
+ if ( log.isConvertibleTo( OpenTest::Value::vtString ) )
+ report_ += log.asString();
+ else
+ report_ += log.toString();
+ if ( report_[ report_.length() -1 ] != '\n' )
+ report_ += "\n\n";
+ }
+
+
} // namespace CppUT
Index: testinfo.cpp
===================================================================
RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** testinfo.cpp 10 Aug 2005 21:34:29 -0000 1.14
--- testinfo.cpp 11 Aug 2005 07:18:24 -0000 1.15
***************
*** 337,340 ****
--- 337,345 ----
}
+ void log( const CppTL::ConstString &log )
+ {
+ TestInfo::threadInstance().log( log );
+ }
+
|