mirror of
https://github.com/boostorg/test.git
synced 2026-01-23 18:12:12 +00:00
Support for build with no exceptions
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/detail/config.hpp>
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
// STL
|
||||
#include <stdexcept> // for std::logic_error
|
||||
@@ -40,7 +41,7 @@
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#define BOOST_TEST_DS_ERROR( msg ) throw std::logic_error( msg )
|
||||
#define BOOST_TEST_DS_ERROR( msg ) BOOST_TEST_IMPL_THROW( std::logic_error( msg ) )
|
||||
#define BOOST_TEST_DS_ASSERT( cond, msg ) if( cond ) {} else BOOST_TEST_DS_ERROR( msg )
|
||||
|
||||
#endif // BOOST_TEST_DATA_CONFIG_HPP_112611GER
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
// Boost.Test
|
||||
#include <boost/test/detail/global_typedef.hpp>
|
||||
#include <boost/test/detail/fwd_decl.hpp>
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
#include <boost/test/utils/class_properties.hpp>
|
||||
|
||||
// Boost
|
||||
@@ -413,9 +415,10 @@ public:
|
||||
// translator holder interface
|
||||
virtual int operator()( boost::function<int ()> const& F )
|
||||
{
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
return m_next ? (*m_next)( F ) : F();
|
||||
} catch( ExceptionType const& e ) {
|
||||
}
|
||||
BOOST_TEST_IMPL_CATCH( ExceptionType, e ) {
|
||||
m_translator( e );
|
||||
return boost::exit_exception_failure;
|
||||
}
|
||||
@@ -462,7 +465,9 @@ public:
|
||||
unit_test::readonly_property<char const*> p_failed_exp;
|
||||
};
|
||||
|
||||
#define BOOST_TEST_SYS_ASSERT( exp ) if( (exp) ) ; else throw ::boost::system_error( BOOST_STRINGIZE( exp ) )
|
||||
#define BOOST_TEST_SYS_ASSERT( exp ) \
|
||||
if( (exp) ) ; \
|
||||
else BOOST_TEST_IMPL_THROW( ::boost::system_error( BOOST_STRINGIZE( exp ) ) )
|
||||
|
||||
// ************************************************************************** //
|
||||
// **************Floating point exception management interface ************** //
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
// Boost.Test
|
||||
#include <boost/test/detail/global_typedef.hpp>
|
||||
#include <boost/test/detail/fwd_decl.hpp>
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
#include <boost/test/utils/trivial_singleton.hpp>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
@@ -61,7 +63,7 @@ namespace framework {
|
||||
/// @param[in] argv command line arguments collection
|
||||
BOOST_TEST_DECL void init( init_unit_test_func init_func, int argc, char* argv[] );
|
||||
|
||||
/// This function applies all the decorators and figures out default run status. This argument facilitates an
|
||||
/// This function applies all the decorators and figures out default run status. This argument facilitates an
|
||||
/// ability of the test cases to prepare some other test units (primarily used internally for self testing)
|
||||
/// @param[in] tu Optional id of the test unit representing root of test tree. If absent, master test suite is used
|
||||
BOOST_TEST_DECL void finalize_setup_phase( test_unit_id tu = INV_TEST_UNIT_ID);
|
||||
@@ -252,7 +254,9 @@ struct BOOST_TEST_DECL setup_error : public std::runtime_error {
|
||||
setup_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {}
|
||||
};
|
||||
|
||||
#define BOOST_TEST_SETUP_ASSERT( cond, msg ) if( cond ) {} else throw unit_test::framework::setup_error( msg )
|
||||
#define BOOST_TEST_SETUP_ASSERT( cond, msg ) \
|
||||
if( cond ) {} \
|
||||
else BOOST_TEST_IMPL_THROW( unit_test::framework::setup_error( msg ) )
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) );
|
||||
::boost::execution_monitor ex_mon;
|
||||
|
||||
@@ -83,11 +83,11 @@ prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char
|
||||
result = ::boost::exit_failure;
|
||||
}
|
||||
}
|
||||
catch( ::boost::execution_exception const& exex ) {
|
||||
BOOST_TEST_IMPL_CATCH( ::boost::execution_exception, exex ) {
|
||||
std::cout << "\n**** exception(" << exex.code() << "): " << exex.what() << std::endl;
|
||||
result = ::boost::exit_exception_failure;
|
||||
}
|
||||
catch( ::boost::system_error const& ex ) {
|
||||
BOOST_TEST_IMPL_CATCH( ::boost::system_error, ex ) {
|
||||
std::cout << "\n**** failed to initialize execution monitor."
|
||||
<< "\n**** expression at fault: " << ex.p_failed_exp
|
||||
<< "\n**** error(" << ex.p_errno << "): " << std::strerror( ex.p_errno ) << std::endl;
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR
|
||||
#include <boost/test/utils/iterator/token_iterator.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -127,7 +130,7 @@ void
|
||||
depends_on::apply( test_unit& tu )
|
||||
{
|
||||
#if !BOOST_TEST_SUPPORT_TOKEN_ITERATOR
|
||||
throw setup_error( "depends_on decorator is not supported on this platform" );
|
||||
BOOST_TEST_SETUP_ASSERT( false, "depends_on decorator is not supported on this platform" );
|
||||
#else
|
||||
string_token_iterator tit( m_dependency, (dropped_delimeters = "/", kept_delimeters = dt_none) );
|
||||
|
||||
@@ -137,8 +140,8 @@ depends_on::apply( test_unit& tu )
|
||||
|
||||
test_unit_id next_id = static_cast<test_suite*>(dep)->get( *tit );
|
||||
|
||||
if( next_id == INV_TEST_UNIT_ID )
|
||||
throw framework::setup_error( std::string( "incorrect dependency specification " ) + m_dependency );
|
||||
BOOST_TEST_SETUP_ASSERT( next_id != INV_TEST_UNIT_ID,
|
||||
std::string( "incorrect dependency specification " ) + m_dependency );
|
||||
|
||||
dep = &framework::get( next_id, TUT_ANY );
|
||||
++tit;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
// Boost.Test
|
||||
#include <boost/test/detail/config.hpp>
|
||||
#include <boost/test/detail/workaround.hpp>
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
#include <boost/test/execution_monitor.hpp>
|
||||
#include <boost/test/debug.hpp>
|
||||
|
||||
@@ -34,8 +35,10 @@
|
||||
#include <boost/cstdlib.hpp> // for exit codes
|
||||
#include <boost/config.hpp> // for workarounds
|
||||
#include <boost/core/ignore_unused.hpp> // for ignore_unused
|
||||
#ifndef BOOST_NO_EXCEPTION
|
||||
#include <boost/exception/get_error_info.hpp> // for get_error_info
|
||||
#include <boost/exception/current_exception_cast.hpp> // for current_exception_cast
|
||||
#endif
|
||||
|
||||
// STL
|
||||
#include <string> // for std::string
|
||||
@@ -189,6 +192,14 @@ namespace { void _set_se_translator( void* ) {} }
|
||||
|
||||
namespace boost {
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** throw_exception ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
#ifdef BOOST_NO_EXCEPTION
|
||||
void throw_exception( std::exception const & e ) { abort(); }
|
||||
#endif
|
||||
|
||||
// ************************************************************************** //
|
||||
// ************** report_error ************** //
|
||||
// ************************************************************************** //
|
||||
@@ -205,6 +216,8 @@ namespace detail {
|
||||
# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) vsnprintf( (a1), (a2), (a3), (a4) )
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTION
|
||||
|
||||
template <typename ErrorInfo>
|
||||
typename ErrorInfo::value_type
|
||||
extract( boost::exception const* ex )
|
||||
@@ -237,17 +250,6 @@ report_error( execution_exception::error_code ec, boost::exception const* be, ch
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
static void
|
||||
report_error( execution_exception::error_code ec, char const* format, ... )
|
||||
{
|
||||
va_list args;
|
||||
va_start( args, format );
|
||||
|
||||
report_error( ec, 0, format, &args );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
static void
|
||||
report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... )
|
||||
{
|
||||
@@ -257,6 +259,19 @@ report_error( execution_exception::error_code ec, boost::exception const* be, ch
|
||||
report_error( ec, be, format, &args );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
static void
|
||||
report_error( execution_exception::error_code ec, char const* format, ... )
|
||||
{
|
||||
va_list args;
|
||||
va_start( args, format );
|
||||
|
||||
report_error( ec, 0, format, &args );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
template<typename Tr,typename Functor>
|
||||
@@ -854,7 +869,7 @@ execution_monitor::catch_signals( boost::function<int ()> const& F )
|
||||
if( !sigsetjmp( signal_handler::jump_buffer(), 1 ) )
|
||||
return detail::do_invoke( m_custom_translators , F );
|
||||
else
|
||||
throw local_signal_handler.sys_sig();
|
||||
return BOOST_TEST_IMPL_THROW( local_signal_handler.sys_sig() );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -1185,13 +1200,15 @@ execution_monitor::execute( boost::function<int ()> const& F )
|
||||
if( debug::under_debugger() )
|
||||
p_catch_system_errors.value = false;
|
||||
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
detail::fpe_except_guard G( p_detect_fp_exceptions );
|
||||
unit_test::ut_detail::ignore_unused_variable_warning( G );
|
||||
|
||||
return catch_signals( F );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTION
|
||||
|
||||
// Catch-clause reference arguments are a bit different from function
|
||||
// arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
|
||||
// required. Programmers ask for const anyhow, so we supply it. That's
|
||||
@@ -1272,6 +1289,8 @@ execution_monitor::execute( boost::function<int ()> const& F )
|
||||
catch( ... )
|
||||
{ detail::report_error( execution_exception::cpp_exception_error, "unknown type" ); }
|
||||
|
||||
#endif // !BOOST_NO_EXCEPTION
|
||||
|
||||
return 0; // never reached; supplied to quiet compiler warnings
|
||||
} // execute
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <boost/test/framework.hpp>
|
||||
#include <boost/test/execution_monitor.hpp>
|
||||
#include <boost/test/debug.hpp>
|
||||
#include <boost/test/unit_test_parameters.hpp>
|
||||
|
||||
#include <boost/test/unit_test_log.hpp>
|
||||
#include <boost/test/unit_test_monitor.hpp>
|
||||
#include <boost/test/results_collector.hpp>
|
||||
@@ -35,12 +37,12 @@
|
||||
#include <boost/test/utils/iterator/token_iterator.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/test/unit_test_parameters.hpp>
|
||||
#include <boost/test/detail/global_typedef.hpp>
|
||||
|
||||
#include <boost/test/utils/foreach.hpp>
|
||||
#include <boost/test/utils/basic_cstring/io.hpp>
|
||||
|
||||
#include <boost/test/detail/global_typedef.hpp>
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
// Boost
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
@@ -140,8 +142,8 @@ assign_sibling_rank( test_unit_id tu_id, order_info_per_tu& tuoi )
|
||||
{
|
||||
test_unit& tu = framework::get( tu_id, TUT_ANY );
|
||||
|
||||
if( tu.p_sibling_rank == (std::numeric_limits<counter_t>::max)() )
|
||||
throw framework::setup_error( "Cyclic dependency detected involving test unit \"" + tu.full_name() + "\"");
|
||||
BOOST_TEST_SETUP_ASSERT( tu.p_sibling_rank != (std::numeric_limits<counter_t>::max)(),
|
||||
"Cyclic dependency detected involving test unit \"" + tu.full_name() + "\"" );
|
||||
|
||||
if( tu.p_sibling_rank != 0 )
|
||||
return tu.p_sibling_rank;
|
||||
@@ -169,7 +171,7 @@ invoke_init_func( init_unit_test_func init_func )
|
||||
{
|
||||
#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
|
||||
if( !(*init_func)() )
|
||||
throw std::runtime_error( "test module initialization failed" );
|
||||
BOOST_TEST_IMPL_THROW( std::runtime_error( "test module initialization failed" ) );
|
||||
#else
|
||||
test_suite* manual_test_units = (*init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv );
|
||||
|
||||
@@ -831,11 +833,11 @@ init( init_unit_test_func init_func, int argc, char* argv[] )
|
||||
using namespace impl;
|
||||
|
||||
// 70. Invoke test module initialization routine
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
s_frk_state().m_aux_em.vexecute( boost::bind( &impl::invoke_init_func, init_func ) );
|
||||
}
|
||||
catch( execution_exception const& ex ) {
|
||||
throw setup_error( ex.what() );
|
||||
BOOST_TEST_IMPL_CATCH( execution_exception, ex ) {
|
||||
BOOST_TEST_SETUP_ASSERT( false, ex.what() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1156,7 +1158,7 @@ get( test_unit_id id, test_unit_type t )
|
||||
test_unit* res = impl::s_frk_state().m_test_units[id];
|
||||
|
||||
if( (res->p_type & t) == 0 )
|
||||
throw internal_error( "Invalid test unit type" );
|
||||
BOOST_TEST_IMPL_THROW( internal_error( "Invalid test unit type" ) );
|
||||
|
||||
return *res;
|
||||
}
|
||||
@@ -1190,11 +1192,11 @@ run( test_unit_id id, bool continue_test )
|
||||
|
||||
if( call_start_finish ) {
|
||||
BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) {
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
impl::s_frk_state().m_aux_em.vexecute( boost::bind( &test_observer::test_start, to, tcc.p_count ) );
|
||||
}
|
||||
catch( execution_exception const& ex ) {
|
||||
throw setup_error( ex.what() );
|
||||
BOOST_TEST_IMPL_CATCH( execution_exception, ex ) {
|
||||
BOOST_TEST_SETUP_ASSERT( false, ex.what() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <boost/test/tree/traverse.hpp>
|
||||
|
||||
// Boost
|
||||
#include <boost/progress.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
@@ -40,6 +39,64 @@ namespace unit_test {
|
||||
// ************** progress_monitor ************** //
|
||||
// ************************************************************************** //
|
||||
|
||||
struct progress_display {
|
||||
progress_display( counter_t expected_count, std::ostream& os )
|
||||
: m_os(os)
|
||||
, m_count( 0 )
|
||||
, m_expected_count( expected_count )
|
||||
, m_next_tic_count( 0 )
|
||||
, m_tic( 0 )
|
||||
{
|
||||
|
||||
m_os << "\n0% 10 20 30 40 50 60 70 80 90 100%"
|
||||
<< "\n|----|----|----|----|----|----|----|----|----|----|"
|
||||
<< std::endl;
|
||||
|
||||
if( !m_expected_count )
|
||||
m_expected_count = 1; // prevent divide by zero
|
||||
}
|
||||
|
||||
unsigned long operator+=( unsigned long increment )
|
||||
{
|
||||
if( (m_count += increment) < m_next_tic_count )
|
||||
return m_count;
|
||||
|
||||
// use of floating point ensures that both large and small counts
|
||||
// work correctly. static_cast<>() is also used several places
|
||||
// to suppress spurious compiler warnings.
|
||||
unsigned int tics_needed = static_cast<unsigned int>(
|
||||
(static_cast<double>(m_count)/m_expected_count)*50.0 );
|
||||
|
||||
do {
|
||||
m_os << '*' << std::flush;
|
||||
} while( ++m_tic < tics_needed );
|
||||
|
||||
m_next_tic_count = static_cast<unsigned long>((m_tic/50.0) * m_expected_count);
|
||||
|
||||
if( m_count == m_expected_count ) {
|
||||
if( m_tic < 51 )
|
||||
m_os << '*';
|
||||
|
||||
m_os << std::endl;
|
||||
}
|
||||
|
||||
return m_count;
|
||||
}
|
||||
unsigned long operator++() { return operator+=( 1 ); }
|
||||
unsigned long count() const { return m_count; }
|
||||
|
||||
private:
|
||||
BOOST_DELETED_FUNCTION(progress_display(progress_display const&))
|
||||
BOOST_DELETED_FUNCTION(progress_display& operator=(progress_display const&))
|
||||
|
||||
std::ostream& m_os; // may not be present in all imps
|
||||
|
||||
unsigned long m_count;
|
||||
unsigned long m_expected_count;
|
||||
unsigned long m_next_tic_count;
|
||||
unsigned int m_tic;
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
struct progress_monitor_impl {
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <boost/test/tree/test_unit.hpp>
|
||||
#include <boost/test/execution_monitor.hpp> // execution_aborted
|
||||
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
// Boost
|
||||
#include <boost/config.hpp>
|
||||
|
||||
@@ -293,7 +295,8 @@ report_assertion( assertion_result const& ar,
|
||||
using namespace unit_test;
|
||||
|
||||
if( framework::current_test_case_id() == INV_TEST_UNIT_ID )
|
||||
throw std::runtime_error( "can't use testing tools outside of test case implementation" );
|
||||
BOOST_TEST_IMPL_THROW(
|
||||
std::runtime_error( "can't use testing tools outside of test case implementation" ) );
|
||||
|
||||
if( !!ar )
|
||||
tl = PASS;
|
||||
@@ -354,7 +357,7 @@ report_assertion( assertion_result const& ar,
|
||||
|
||||
framework::test_unit_aborted( framework::current_test_case() );
|
||||
|
||||
throw execution_aborted();
|
||||
BOOST_TEST_IMPL_THROW( execution_aborted() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -97,7 +97,8 @@ test_unit::~test_unit()
|
||||
void
|
||||
test_unit::depends_on( test_unit* tu )
|
||||
{
|
||||
BOOST_TEST_SETUP_ASSERT( p_id != framework::master_test_suite().p_id, "Can't add dependency to the master test suite" );
|
||||
BOOST_TEST_SETUP_ASSERT( p_id != framework::master_test_suite().p_id,
|
||||
"Can't add dependency to the master test suite" );
|
||||
|
||||
p_dependencies.value.push_back( tu->p_id );
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ unit_test_main( init_unit_test_func init_func, int argc, char* argv[] )
|
||||
{
|
||||
int result_code = 0;
|
||||
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
framework::init( init_func, argc, argv );
|
||||
|
||||
if( runtime_config::wait_for_debugger() ) {
|
||||
@@ -233,20 +233,20 @@ unit_test_main( init_unit_test_func init_func, int argc, char* argv[] )
|
||||
? boost::exit_success
|
||||
: results_collector.results( framework::master_test_suite().p_id ).result_code();
|
||||
}
|
||||
catch( framework::nothing_to_test const& ) {
|
||||
BOOST_TEST_IMPL_CATCH0( framework::nothing_to_test ) {
|
||||
result_code = boost::exit_success;
|
||||
}
|
||||
catch( framework::internal_error const& ex ) {
|
||||
BOOST_TEST_IMPL_CATCH( framework::internal_error, ex ) {
|
||||
results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl;
|
||||
|
||||
result_code = boost::exit_exception_failure;
|
||||
}
|
||||
catch( framework::setup_error const& ex ) {
|
||||
BOOST_TEST_IMPL_CATCH( framework::setup_error, ex ) {
|
||||
results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl;
|
||||
|
||||
result_code = boost::exit_exception_failure;
|
||||
}
|
||||
catch( ... ) {
|
||||
BOOST_TEST_IMPL_CATCHALL() {
|
||||
results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl;
|
||||
|
||||
result_code = boost::exit_exception_failure;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace unit_test {
|
||||
unit_test_monitor_t::error_level
|
||||
unit_test_monitor_t::execute_and_translate( boost::function<void ()> const& func, unsigned timeout )
|
||||
{
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
p_catch_system_errors.value = runtime_config::catch_sys_errors();
|
||||
p_timeout.value = timeout;
|
||||
p_auto_start_dbg.value = runtime_config::auto_start_dbg();
|
||||
@@ -45,7 +45,7 @@ unit_test_monitor_t::execute_and_translate( boost::function<void ()> const& func
|
||||
|
||||
vexecute( func );
|
||||
}
|
||||
catch( execution_exception const& ex ) {
|
||||
BOOST_TEST_IMPL_CATCH( execution_exception, ex ) {
|
||||
framework::exception_caught( ex );
|
||||
framework::test_unit_aborted( framework::current_test_case() );
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#define BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER
|
||||
|
||||
// Boost.Test
|
||||
|
||||
#include <boost/test/unit_test_parameters.hpp>
|
||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
#include <boost/test/utils/basic_cstring/compare.hpp>
|
||||
@@ -28,6 +27,8 @@
|
||||
#include <boost/test/debug.hpp>
|
||||
#include <boost/test/framework.hpp>
|
||||
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
// Boost.Runtime.Param
|
||||
#include <boost/test/utils/runtime/cla/dual_name_parameter.hpp>
|
||||
#include <boost/test/utils/runtime/cla/parser.hpp>
|
||||
@@ -273,7 +274,7 @@ init( int& argc, char** argv )
|
||||
{
|
||||
using namespace cla;
|
||||
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
if( s_cla_parser.num_params() != 0 )
|
||||
s_cla_parser.reset();
|
||||
else
|
||||
@@ -359,7 +360,7 @@ init( int& argc, char** argv )
|
||||
|
||||
if( s_cla_parser["help"] ) {
|
||||
s_cla_parser.help( std::cout );
|
||||
throw framework::nothing_to_test();
|
||||
BOOST_TEST_IMPL_THROW( framework::nothing_to_test() );
|
||||
}
|
||||
|
||||
s_report_format = retrieve_parameter( REPORT_FORMAT, s_cla_parser, unit_test::OF_CLF );
|
||||
@@ -372,13 +373,13 @@ init( int& argc, char** argv )
|
||||
|
||||
s_test_to_run = retrieve_parameter<std::list<std::string> >( TESTS_TO_RUN, s_cla_parser );
|
||||
}
|
||||
catch( rt::logic_error const& ex ) {
|
||||
BOOST_TEST_IMPL_CATCH( rt::logic_error, ex ) {
|
||||
std::ostringstream err;
|
||||
|
||||
err << "Fail to process runtime parameters: " << ex.msg() << std::endl;
|
||||
s_cla_parser.usage( err );
|
||||
|
||||
throw framework::setup_error( err.str() );
|
||||
BOOST_TEST_SETUP_ASSERT( false, err.str() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,11 +587,11 @@ detect_memory_leaks()
|
||||
if( runtime::interpret_argument_value_impl<bool>::_( value, bool_val ) )
|
||||
s_value = *bool_val ? 1L : 0L;
|
||||
else {
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
// if representable as long - this is leak number
|
||||
s_value = boost::lexical_cast<long>( value );
|
||||
}
|
||||
catch( boost::bad_lexical_cast const& ) {
|
||||
BOOST_TEST_IMPL_CATCH0( boost::bad_lexical_cast ) {
|
||||
// value is leak report file and detection is enabled
|
||||
s_value = 1L;
|
||||
}
|
||||
|
||||
@@ -405,4 +405,3 @@ public:
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
@@ -57,7 +59,7 @@ inline void
|
||||
report_access_to_invalid_parameter(bool v)
|
||||
{
|
||||
if(v)
|
||||
throw access_to_invalid_parameter();
|
||||
BOOST_TEST_IMPL_THROW( access_to_invalid_parameter() );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
@@ -123,14 +123,14 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr )
|
||||
{
|
||||
boost::optional<T> value;
|
||||
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
m_value_interpreter( tr, value );
|
||||
}
|
||||
catch( ... ) { // !! should we do that?
|
||||
BOOST_TEST_IMPL_CATCHALL() { // !! should we do that?
|
||||
BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Fail to parse argument value" );
|
||||
|
||||
if( !p.p_optional_value )
|
||||
throw;
|
||||
BOOST_TEST_IMPL_RETHROW;
|
||||
}
|
||||
|
||||
argument_ptr actual_arg = p.actual_argument();
|
||||
|
||||
@@ -108,7 +108,7 @@ parser::parse( int& argc, char_type** argv )
|
||||
|
||||
m_traverser.init( argc, argv );
|
||||
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
while( !m_traverser.eoi() ) {
|
||||
parameter_ptr found_param;
|
||||
|
||||
@@ -151,10 +151,10 @@ parser::parse( int& argc, char_type** argv )
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( bad_lexical_cast const& ) {
|
||||
BOOST_TEST_IMPL_CATCH0( bad_lexical_cast ) {
|
||||
BOOST_TEST_UTILS_RUNTIME_PARAM_REPORT_LOGIC_ERROR(
|
||||
BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "String to value convertion error during input parsing" ) );
|
||||
}
|
||||
};
|
||||
|
||||
m_traverser.remainder( argc, argv );
|
||||
}
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
#include <boost/test/utils/runtime/cla/validation.hpp>
|
||||
#include <boost/test/utils/runtime/validation.hpp> // BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error
|
||||
|
||||
// Boost
|
||||
// Boost.Test
|
||||
#include <boost/test/utils/basic_cstring/io.hpp>
|
||||
|
||||
// STL
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -48,7 +47,7 @@ report_input_error( argv_traverser const& tr, format_stream& msg )
|
||||
msg << tr.input();
|
||||
}
|
||||
|
||||
throw BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error( msg.str() );
|
||||
BOOST_TEST_IMPL_THROW( BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error( msg.str() ) );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
@@ -53,7 +53,7 @@ init_new_var( cstring var_name, Modifiers m = nfp::no_params )
|
||||
cstring str_value = sys_read_var( new_vd.m_var_name );
|
||||
|
||||
if( !str_value.is_empty() ) {
|
||||
try {
|
||||
BOOST_TEST_IMPL_TRY {
|
||||
boost::optional<T> value;
|
||||
|
||||
if( m.has( interpreter ) )
|
||||
@@ -67,7 +67,7 @@ init_new_var( cstring var_name, Modifiers m = nfp::no_params )
|
||||
arg_value<T>( *new_vd.m_value ) = *value;
|
||||
}
|
||||
}
|
||||
catch( ... ) { // !! could we do that
|
||||
BOOST_TEST_IMPL_CATCHALL() { // !! could we do that
|
||||
// !! should we report an error?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
// Boost.Test
|
||||
#include <boost/test/utils/class_properties.hpp>
|
||||
#include <boost/test/detail/throw_exception.hpp>
|
||||
|
||||
// Boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@@ -64,7 +65,7 @@ private:
|
||||
inline void
|
||||
report_logic_error( format_stream& msg )
|
||||
{
|
||||
throw BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error( msg.str() );
|
||||
BOOST_TEST_IMPL_THROW( BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error( msg.str() ) );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
@@ -33,6 +33,11 @@ rule boost.test-self-test ( test-rule : test-suite : test-name : usage-variant ?
|
||||
<toolset>clang:<cxxflags>-std=c++11
|
||||
# <toolset>clang:<cxxflags>-Wconversion
|
||||
# <toolset>clang:<cxxflags>-Wno-sign-conversion
|
||||
# <toolset>gcc:<cxxflags>-E
|
||||
# <toolset>gcc:<cxxflags>-fno-exceptions
|
||||
# <toolset>gcc:<cxxflags>-DBOOST_NO_EXCEPTION
|
||||
# <toolset>clang:<cxxflags>-fno-exceptions
|
||||
# <toolset>clang:<cxxflags>-DBOOST_NO_EXCEPTION
|
||||
<warnings>all
|
||||
$(extra-options)
|
||||
: $(test-name)
|
||||
|
||||
Reference in New Issue
Block a user