Thread: [Cppunit-cvs] cppunit2/src/cpputtest SConscript,1.14,1.15 main.cpp,1.25,1.26 testexceptionguard.cpp,
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-11-11 20:54:24
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6524/src/cpputtest Modified Files: SConscript main.cpp testexceptionguard.cpp Log Message: - added unit tests for TestInfo - fixed bug in CPPUT_IGNORE_FAILURE and exception guard. - added 'isIgnoredFailure' to Assertion. - lighttestrunner now print ignored failure and skipped tests. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** main.cpp 8 Nov 2005 23:25:31 -0000 1.25 --- main.cpp 11 Nov 2005 20:54:15 -0000 1.26 *************** *** 4,11 **** #include "assertenumtest.h" #include "assertstringtest.h" - #include "registrytest.h" #include "enumeratortest.h" - #include "testfixturetest.h" #include "reflectiontest.h" //#include "formattest.h" --- 4,11 ---- #include "assertenumtest.h" #include "assertstringtest.h" #include "enumeratortest.h" #include "reflectiontest.h" + #include "registrytest.h" + #include "testfixturetest.h" //#include "formattest.h" *************** *** 19,22 **** --- 19,23 ---- bool testTestCase(); bool testFunctors(); + bool testTestInfo(); *************** *** 25,28 **** --- 26,30 ---- return testBasicAssertions() && testFunctors() && + testTestInfo() && testExceptionGuard() && // testTestContext() && Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/SConscript,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SConscript 10 Nov 2005 09:05:41 -0000 1.14 --- SConscript 11 Nov 2005 20:54:15 -0000 1.15 *************** *** 11,14 **** --- 11,15 ---- testfunctor.cpp testfixturetest.cpp + testinfotest.cpp testtestcase.cpp testtestsuite.cpp Index: testexceptionguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testexceptionguard.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testexceptionguard.cpp 10 Aug 2005 21:34:29 -0000 1.2 --- testexceptionguard.cpp 11 Nov 2005 20:54:15 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- { ++*value; + CppUT::TestInfo::threadInstance().testStatus().setStatus( CppUT::TestStatus::failed ); } *************** *** 43,49 **** int value = 1; CppUT::ExceptionGuard guard; bool result = guard.protect( CppTL::bind_cfn( &increment, &value ) ); CPPUT_ASSERT_EQUAL( 2, value ); ! CPPUT_ASSERT_EQUAL( true, result ); } --- 44,51 ---- int value = 1; CppUT::ExceptionGuard guard; + CppUT::TestInfo::threadInstance().startNewTest(); bool result = guard.protect( CppTL::bind_cfn( &increment, &value ) ); CPPUT_ASSERT_EQUAL( 2, value ); ! ( true, result ); } *************** *** 53,56 **** --- 55,59 ---- { CppUT::ExceptionGuard guard; + CppUT::TestInfo::threadInstance().startNewTest(); bool result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 62,65 **** --- 65,69 ---- { CppUT::ExceptionGuard guard; + CppUT::TestInfo::threadInstance().startNewTest(); bool result = guard.protect( CppTL::cfn0( &throwAnyException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 71,74 **** --- 75,79 ---- { ++*value; + CppUT::TestInfo::threadInstance().testStatus().setStatus( CppUT::TestStatus::failed ); } *************** *** 82,85 **** --- 87,91 ---- CppTL::bind2( CppTL::cfn2( &customExceptionTranslation ), &value ), CppTL::Type<CustomException>() ); + CppUT::TestInfo::threadInstance().startNewTest(); bool result = guard.protect( CppTL::cfn0( &throwCustomException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 87,94 **** --- 93,102 ---- // check that standard and ... catch handler are still active. + CppUT::TestInfo::threadInstance().startNewTest(); result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); CPPUT_ASSERT_EQUAL( 2, value ); + CppUT::TestInfo::threadInstance().startNewTest(); result = guard.protect( CppTL::cfn0( &throwAnyException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 98,105 **** --- 106,115 ---- // check that standard and ... catch handler are still active, // but not the custom exception handler. + CppUT::TestInfo::threadInstance().startNewTest(); result = guard.protect( CppTL::cfn0( &throwCustomException ) ); CPPUT_ASSERT_EQUAL( false, result ); CPPUT_ASSERT_EQUAL( 2, value ); + CppUT::TestInfo::threadInstance().startNewTest(); result = guard.protect( CppTL::cfn0( &throwStdException ) ); CPPUT_ASSERT_EQUAL( false, result ); *************** *** 107,110 **** --- 117,124 ---- + /* Notes: startNewtest() must be called before each protect because + * protect() returns value depends on testStatus. + */ + bool testExceptionGuard() { *************** *** 112,115 **** --- 126,130 ---- try { + CppUT::TestInfo::threadInstance().startNewTest(); testExceptionGuardRunFunctor(); testExceptionGuardCatchStandardException(); |