Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57854 - in trunk/boost/test: impl utils
From: gennadiy.rozental_at_[hidden]
Date: 2009-11-22 22:01:40


Author: rogeeff
Date: 2009-11-22 22:01:38 EST (Sun, 22 Nov 2009)
New Revision: 57854
URL: http://svn.boost.org/trac/boost/changeset/57854

Log:
Use CData to print error message. Fixes #3636
Text files modified:
   trunk/boost/test/impl/xml_log_formatter.ipp | 14 +++++++-------
   trunk/boost/test/utils/xml_printer.hpp | 9 ++++-----
   2 files changed, 11 insertions(+), 12 deletions(-)

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 2009-11-22 22:01:38 EST (Sun, 22 Nov 2009)
@@ -120,13 +120,13 @@
     if( !loc.m_function.is_empty() )
         ostr << " function" << attr_value() << loc.m_function;
 
- ostr << ">" << pcdata() << ex.what();
+ ostr << ">" << cdata() << ex.what();
 
     if( !checkpoint_data.m_file_name.is_empty() ) {
         ostr << "<LastCheckpoint file" << attr_value() << checkpoint_data.m_file_name
              << " line" << attr_value() << checkpoint_data.m_line_num
              << ">"
- << pcdata() << checkpoint_data.m_message
+ << cdata() << checkpoint_data.m_message
              << "</LastCheckpoint>";
     }
 
@@ -142,9 +142,9 @@
 
     m_curr_tag = xml_tags[let];
     ostr << '<' << m_curr_tag
- << " file" << attr_value() << entry_data.m_file_name
- << " line" << attr_value() << entry_data.m_line_num
- << ">";
+ << BOOST_TEST_L( " file" ) << attr_value() << entry_data.m_file_name
+ << BOOST_TEST_L( " line" ) << attr_value() << entry_data.m_line_num
+ << BOOST_TEST_L( "><![CDATA[" );
 }
 
 //____________________________________________________________________________//
@@ -152,7 +152,7 @@
 void
 xml_log_formatter::log_entry_value( std::ostream& ostr, const_string value )
 {
- ostr << pcdata() << value;
+ ostr << value;
 }
 
 //____________________________________________________________________________//
@@ -160,7 +160,7 @@
 void
 xml_log_formatter::log_entry_finish( std::ostream& ostr )
 {
- ostr << "</" << m_curr_tag << ">";
+ ostr << BOOST_TEST_L( "]]></" ) << m_curr_tag << BOOST_TEST_L( ">" );
 
     m_curr_tag.clear();
 }

Modified: trunk/boost/test/utils/xml_printer.hpp
==============================================================================
--- trunk/boost/test/utils/xml_printer.hpp (original)
+++ trunk/boost/test/utils/xml_printer.hpp 2009-11-22 22:01:38 EST (Sun, 22 Nov 2009)
@@ -20,6 +20,7 @@
 #include <boost/test/utils/fixed_mapping.hpp>
 #include <boost/test/utils/custom_manip.hpp>
 #include <boost/test/utils/foreach.hpp>
+#include <boost/test/utils/basic_cstring/io.hpp>
 
 // Boost
 #include <boost/config.hpp>
@@ -96,14 +97,12 @@
 
 //____________________________________________________________________________//
 
-typedef custom_manip<struct pcdata_t> pcdata;
+typedef custom_manip<struct cdata_t> cdata;
 
 inline std::ostream&
-operator<<( custom_printer<pcdata> const& p, const_string value )
+operator<<( custom_printer<cdata> const& p, const_string value )
 {
- print_escaped( *p, value );
-
- return *p;
+ return *p << BOOST_TEST_L( "<![CDATA[" ) << value << BOOST_TEST_L( "]]>" );
 }
 
 //____________________________________________________________________________//


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