XS-libboost-mini
view release on metacpan or search on metacpan
include/boost/test/impl/junit_log_formatter.ipp view on Meta::CPAN
return;
}
m_stream
<< "<" << entry_type
<< " message" << utils::attr_value() << log.logentry_message
<< " type" << utils::attr_value() << log.logentry_type
<< ">";
if(!log.output.empty()) {
m_stream << utils::cdata() << "\n" + log.output;
}
m_stream << "</" << entry_type << ">";
}
struct conditional_cdata_helper {
std::ostream &ostr;
std::string const field;
bool empty;
conditional_cdata_helper(std::ostream &ostr_, std::string field_)
: ostr(ostr_)
, field(field_)
, empty(true)
{}
~conditional_cdata_helper() {
if(!empty) {
ostr << BOOST_TEST_L( "]]>" ) << "</" << field << '>' << std::endl;
}
}
void operator()(const std::string& s) {
bool current_empty = s.empty();
if(empty) {
if(!current_empty) {
empty = false;
include/boost/test/impl/junit_log_formatter.ipp view on Meta::CPAN
<< " name" << utils::attr_value() << name
<< " time" << utils::attr_value() << double(tr->p_duration_microseconds) * 1E-6
<< ">" << std::endl;
}
void write_testcase_system_out(junit_impl::junit_log_helper const &detailed_log,
test_unit const * tu,
bool skipped) const
{
// system-out + all info/messages, the object skips the empty entries
conditional_cdata_helper system_out_helper(m_stream, "system-out");
// indicate why the test has been skipped first
if( skipped ) {
std::list<std::string> skipping_decision_chain = build_skipping_chain(*tu);
for(list_str_citerator it(skipping_decision_chain.begin()), ite(skipping_decision_chain.end());
it != ite;
++it)
{
system_out_helper(*it);
}
include/boost/test/impl/junit_log_formatter.ipp view on Meta::CPAN
for(list_str_citerator it(detailed_log.system_err.begin()), ite(detailed_log.system_err.end());
it != ite;
++it)
{
o << *it;
}
if(!detailed_log.system_err.empty())
o << std::endl << "STDERR END ------------" << std::endl;
conditional_cdata_helper system_err_helper(m_stream, "system-err");
system_err_helper(o.str());
}
}
int get_nb_assertions(junit_impl::junit_log_helper const &detailed_log,
test_unit const & tu,
test_results const *tr) const {
int nb_assertions(-1);
if( tu.p_type == TUT_SUITE ) {
nb_assertions = 0;
include/boost/test/impl/xml_log_formatter.ipp view on Meta::CPAN
xml_log_formatter::log_exception_start( std::ostream& ostr, log_checkpoint_data const& checkpoint_data, execution_exception const& ex )
{
execution_exception::location const& loc = ex.where();
ostr << "<Exception file" << utils::attr_value() << loc.m_file_name
<< " line" << utils::attr_value() << loc.m_line_num;
if( !loc.m_function.is_empty() )
ostr << " function" << utils::attr_value() << loc.m_function;
ostr << ">" << utils::cdata() << ex.what();
if( !checkpoint_data.m_file_name.is_empty() ) {
ostr << "<LastCheckpoint file" << utils::attr_value() << checkpoint_data.m_file_name
<< " line" << utils::attr_value() << checkpoint_data.m_line_num
<< ">"
<< utils::cdata() << checkpoint_data.m_message
<< "</LastCheckpoint>";
}
}
//____________________________________________________________________________//
void
xml_log_formatter::log_exception_finish( std::ostream& ostr )
{
ostr << "</Exception>";
include/boost/test/impl/xml_log_formatter.ipp view on Meta::CPAN
<< BOOST_TEST_L( "><![CDATA[" );
m_value_closed = false;
}
//____________________________________________________________________________//
void
xml_log_formatter::log_entry_value( std::ostream& ostr, const_string value )
{
utils::print_escaped_cdata( ostr, value );
}
//____________________________________________________________________________//
void
xml_log_formatter::log_entry_finish( std::ostream& ostr )
{
if( !m_value_closed ) {
ostr << BOOST_TEST_L( "]]>" );
m_value_closed = true;
include/boost/test/impl/xml_log_formatter.ipp view on Meta::CPAN
xml_log_formatter::entry_context_finish( std::ostream& ostr, log_level )
{
ostr << BOOST_TEST_L( "</Context>" );
}
//____________________________________________________________________________//
void
xml_log_formatter::log_entry_context( std::ostream& ostr, log_level, const_string context_descr )
{
ostr << BOOST_TEST_L( "<Frame>" ) << utils::cdata() << context_descr << BOOST_TEST_L( "</Frame>" );
}
//____________________________________________________________________________//
} // namespace output
} // namespace unit_test
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
include/boost/test/utils/xml_printer.hpp view on Meta::CPAN
template<typename T>
inline void
print_escaped( std::ostream& where_to, T const& value )
{
where_to << value;
}
//____________________________________________________________________________//
inline void
print_escaped_cdata( std::ostream& where_to, const_string value )
{
static const_string cdata_end( "]]>" );
const_string::size_type pos = value.find( cdata_end );
if( pos == const_string::npos )
where_to << value;
else {
where_to << value.substr( 0, pos+2 ) << cdata_end
<< BOOST_TEST_L( "<![CDATA[" ) << value.substr( pos+2 );
}
}
//____________________________________________________________________________//
typedef custom_manip<struct attr_value_t> attr_value;
template<typename T>
inline std::ostream&
include/boost/test/utils/xml_printer.hpp view on Meta::CPAN
{
*p << "=\"";
print_escaped( *p, value );
*p << '"';
return *p;
}
//____________________________________________________________________________//
typedef custom_manip<struct cdata_t> cdata;
inline std::ostream&
operator<<( custom_printer<cdata> const& p, const_string value )
{
*p << BOOST_TEST_L( "<![CDATA[" );
print_escaped_cdata( *p, value );
return *p << BOOST_TEST_L( "]]>" );
}
//____________________________________________________________________________//
} // namespace utils
} // namespace unit_test
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
( run in 0.281 second using v1.01-cache-2.11-cpan-ec4f86ec37b )