Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56029 - trunk/boost/test/impl
From: gennadiy.rozental_at_[hidden]
Date: 2009-09-05 04:49:08


Author: rogeeff
Date: 2009-09-05 04:49:07 EDT (Sat, 05 Sep 2009)
New Revision: 56029
URL: http://svn.boost.org/trac/boost/changeset/56029

Log:
enable logging from initialization procedures
Text files modified:
   trunk/boost/test/impl/compiler_log_formatter.ipp | 22 ++++++++++++++++++----
   1 files changed, 18 insertions(+), 4 deletions(-)

Modified: trunk/boost/test/impl/compiler_log_formatter.ipp
==============================================================================
--- trunk/boost/test/impl/compiler_log_formatter.ipp (original)
+++ trunk/boost/test/impl/compiler_log_formatter.ipp 2009-09-05 04:49:07 EDT (Sat, 05 Sep 2009)
@@ -42,6 +42,20 @@
 // ************** compiler_log_formatter ************** //
 // ************************************************************************** //
 
+namespace {
+
+const_string
+test_phase_identifier()
+{
+ return framework::is_initialized()
+ ? framework::current_test_case().p_name.get()
+ : BOOST_TEST_L( "Test setup" );
+}
+
+} // local namespace
+
+//____________________________________________________________________________//
+
 void
 compiler_log_formatter::log_start( std::ostream& output, counter_t test_cases_amount )
 {
@@ -113,7 +127,7 @@
     execution_exception::location const& loc = ex.where();
     print_prefix( output, loc.m_file_name, loc.m_line_num );
 
- output << "fatal error in \"" << (loc.m_function.is_empty() ? framework::current_test_case().p_name.get() : loc.m_function ) << "\": ";
+ output << "fatal error in \"" << (loc.m_function.is_empty() ? test_phase_identifier() : loc.m_function ) << "\": ";
 
     output << ex.what();
 
@@ -142,15 +156,15 @@
             break;
         case BOOST_UTL_ET_WARNING:
             print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
- output << "warning in \"" << framework::current_test_case().p_name << "\": ";
+ output << "warning in \"" << test_phase_identifier() << "\": ";
             break;
         case BOOST_UTL_ET_ERROR:
             print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
- output << "error in \"" << framework::current_test_case().p_name << "\": ";
+ output << "error in \"" << test_phase_identifier() << "\": ";
             break;
         case BOOST_UTL_ET_FATAL_ERROR:
             print_prefix( output, entry_data.m_file_name, entry_data.m_line_num );
- output << "fatal error in \"" << framework::current_test_case().p_name << "\": ";
+ output << "fatal error in \"" << test_phase_identifier() << "\": ";
             break;
     }
 }


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