Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48766 - in trunk/boost/test: . impl
From: gennadiy.rozental_at_[hidden]
Date: 2008-09-13 04:59:33


Author: rogeeff
Date: 2008-09-13 04:59:31 EDT (Sat, 13 Sep 2008)
New Revision: 48766
URL: http://svn.boost.org/trac/boost/changeset/48766

Log:
avoid double test case report for exceptions
properly handle exceptions in test unit constructor
avoid cycle include in test_case_template.hpp
avoid test unit copy during filtering
Text files modified:
   trunk/boost/test/framework.hpp | 1 +
   trunk/boost/test/impl/framework.ipp | 9 +++++++++
   trunk/boost/test/impl/unit_test_main.ipp | 2 +-
   trunk/boost/test/impl/unit_test_suite.ipp | 7 +++++++
   trunk/boost/test/impl/xml_log_formatter.ipp | 3 +--
   trunk/boost/test/test_case_template.hpp | 3 ---
   trunk/boost/test/unit_test_suite_impl.hpp | 3 +++
   7 files changed, 22 insertions(+), 6 deletions(-)

Modified: trunk/boost/test/framework.hpp
==============================================================================
--- trunk/boost/test/framework.hpp (original)
+++ trunk/boost/test/framework.hpp 2008-09-13 04:59:31 EDT (Sat, 13 Sep 2008)
@@ -54,6 +54,7 @@
 // mutation access methods
 BOOST_TEST_DECL void register_test_unit( test_case* tc );
 BOOST_TEST_DECL void register_test_unit( test_suite* ts );
+BOOST_TEST_DECL void deregister_test_unit( test_unit* tu );
 
 BOOST_TEST_DECL void register_observer( test_observer& );
 BOOST_TEST_DECL void deregister_observer( test_observer& );

Modified: trunk/boost/test/impl/framework.ipp
==============================================================================
--- trunk/boost/test/impl/framework.ipp (original)
+++ trunk/boost/test/impl/framework.ipp 2008-09-13 04:59:31 EDT (Sat, 13 Sep 2008)
@@ -122,6 +122,7 @@
     ~framework_impl()
     {
         BOOST_TEST_FOREACH( test_unit_store::value_type const&, tu, m_test_units ) {
+ // these delete statements will erase map elements, but iterators should be fine
             if( test_id_2_unit_type( tu.second->p_id ) == tut_suite )
                 delete (test_suite const*)tu.second;
             else
@@ -316,6 +317,14 @@
 //____________________________________________________________________________//
 
 void
+deregister_test_unit( test_unit* tu )
+{
+ s_frk_impl().m_test_units.erase( tu->p_id );
+}
+
+//____________________________________________________________________________//
+
+void
 register_observer( test_observer& to )
 {
     s_frk_impl().m_observers.insert( &to );

Modified: trunk/boost/test/impl/unit_test_main.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_main.ipp (original)
+++ trunk/boost/test/impl/unit_test_main.ipp 2008-09-13 04:59:31 EDT (Sat, 13 Sep 2008)
@@ -131,7 +131,7 @@
         std::vector<single_filter> const& filters = m_filters[m_depth-2];
 
         tu.p_enabled.value =
- std::find_if( filters.begin(), filters.end(), bind( &single_filter::pass, _1, tu ) ) != filters.end();
+ std::find_if( filters.begin(), filters.end(), bind( &single_filter::pass, _1, boost::ref(tu) ) ) != filters.end();
     }
 
     // test tree visitor interface

Modified: trunk/boost/test/impl/unit_test_suite.ipp
==============================================================================
--- trunk/boost/test/impl/unit_test_suite.ipp (original)
+++ trunk/boost/test/impl/unit_test_suite.ipp 2008-09-13 04:59:31 EDT (Sat, 13 Sep 2008)
@@ -60,6 +60,13 @@
 
 //____________________________________________________________________________//
 
+test_unit::~test_unit()
+{
+ framework::deregister_test_unit( this );
+}
+
+//____________________________________________________________________________//
+
 void
 test_unit::depends_on( test_unit* tu )
 {

Modified: trunk/boost/test/impl/xml_log_formatter.ipp
==============================================================================
--- trunk/boost/test/impl/xml_log_formatter.ipp (original)
+++ trunk/boost/test/impl/xml_log_formatter.ipp 2008-09-13 04:59:31 EDT (Sat, 13 Sep 2008)
@@ -112,8 +112,7 @@
 void
 xml_log_formatter::log_exception( std::ostream& ostr, log_checkpoint_data const& checkpoint_data, const_string explanation )
 {
- ostr << "<Exception name" << attr_value() << framework::current_test_case().p_name.get() << ">"
- << pcdata() << explanation;
+ ostr << "<Exception>" << pcdata() << explanation;
 
     if( !checkpoint_data.m_file_name.is_empty() ) {
         ostr << "<LastCheckpoint file" << attr_value() << checkpoint_data.m_file_name

Modified: trunk/boost/test/test_case_template.hpp
==============================================================================
--- trunk/boost/test/test_case_template.hpp (original)
+++ trunk/boost/test/test_case_template.hpp 2008-09-13 04:59:31 EDT (Sat, 13 Sep 2008)
@@ -16,9 +16,6 @@
 #ifndef BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER
 #define BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER
 
-// Boost.Test
-#include <boost/test/unit_test_suite.hpp>
-
 // Boost
 #include <boost/mpl/for_each.hpp>
 #include <boost/mpl/identity.hpp>

Modified: trunk/boost/test/unit_test_suite_impl.hpp
==============================================================================
--- trunk/boost/test/unit_test_suite_impl.hpp (original)
+++ trunk/boost/test/unit_test_suite_impl.hpp 2008-09-13 04:59:31 EDT (Sat, 13 Sep 2008)
@@ -71,6 +71,9 @@
 
     void increase_exp_fail( unsigned num );
 
+protected:
+ ~test_unit();
+
 private:
     // Data members
     std::list<test_unit_id> m_dependencies;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk