mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Fix
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@156 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
5754f053d8
commit
f9154334cf
1 changed files with 33 additions and 50 deletions
|
|
@ -26,15 +26,15 @@ namespace mock
|
||||||
struct exception : public boost::execution_aborted
|
struct exception : public boost::execution_aborted
|
||||||
{};
|
{};
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
template< typename Result >
|
template< typename Result >
|
||||||
Result abort()
|
struct boost_test_error_policy
|
||||||
|
{
|
||||||
|
static Result abort()
|
||||||
{
|
{
|
||||||
throw boost::enable_current_exception( exception() );
|
throw boost::enable_current_exception( exception() );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fail(
|
static void fail(
|
||||||
const std::string& message, const std::string& context,
|
const std::string& message, const std::string& context,
|
||||||
const std::string& file = "unknown location", int line = 0 )
|
const std::string& file = "unknown location", int line = 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -46,70 +46,53 @@ namespace detail
|
||||||
<< "mock error: " << message << ": " << context
|
<< "mock error: " << message << ": " << context
|
||||||
<< boost::unit_test::log::end();
|
<< boost::unit_test::log::end();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
template< typename Result >
|
|
||||||
struct boost_test_error_policy
|
|
||||||
{
|
|
||||||
|
|
||||||
#else // MOCK_USE_BOOST_TEST
|
#else // MOCK_USE_BOOST_TEST
|
||||||
|
|
||||||
struct exception
|
struct exception
|
||||||
{};
|
{};
|
||||||
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
template< typename Result >
|
template< typename Result >
|
||||||
Result abort()
|
struct basic_error_policy
|
||||||
|
{
|
||||||
|
static Result abort()
|
||||||
{
|
{
|
||||||
throw exception();
|
throw exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fail(
|
static void fail(
|
||||||
const std::string& message, const std::string& context,
|
const std::string& message, const std::string& context,
|
||||||
const std::string& file = "unknown location", int line = 0 )
|
const std::string& file = "unknown location", int line = 0 )
|
||||||
{
|
{
|
||||||
std::cerr << file << '(' << line << "): "
|
std::cerr << file << '(' << line << "): "
|
||||||
<< "mock error: " << message << ": " << context << std::endl;
|
<< "mock error: " << message << ": " << context << std::endl;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
template< typename Result >
|
|
||||||
struct basic_error_policy
|
|
||||||
{
|
|
||||||
|
|
||||||
#endif // MOCK_USE_BOOST_TEST
|
#endif // MOCK_USE_BOOST_TEST
|
||||||
|
|
||||||
static Result abort()
|
|
||||||
{
|
|
||||||
return mock::detail::abort< Result >();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void missing_action( const std::string& context,
|
static void missing_action( const std::string& context,
|
||||||
const std::string& file, int line )
|
const std::string& file, int line )
|
||||||
{
|
{
|
||||||
mock::detail::fail( "missing action", context,
|
fail( "missing action", context, file, line );
|
||||||
file, line );
|
|
||||||
}
|
}
|
||||||
static void unexpected_call( const std::string& context )
|
static void unexpected_call( const std::string& context )
|
||||||
{
|
{
|
||||||
mock::detail::fail( "unexpected call", context );
|
fail( "unexpected call", context );
|
||||||
}
|
}
|
||||||
static void sequence_failed( const std::string& context,
|
static void sequence_failed( const std::string& context,
|
||||||
const std::string& /*file*/, int /*line*/ )
|
const std::string& /*file*/, int /*line*/ )
|
||||||
{
|
{
|
||||||
mock::detail::fail( "sequence failed", context );
|
fail( "sequence failed", context );
|
||||||
}
|
}
|
||||||
static void verification_failed( const std::string& context,
|
static void verification_failed( const std::string& context,
|
||||||
const std::string& file, int line )
|
const std::string& file, int line )
|
||||||
{
|
{
|
||||||
mock::detail::fail( "verification failed", context, file, line );
|
fail( "verification failed", context, file, line );
|
||||||
}
|
}
|
||||||
static void untriggered_expectation( const std::string& context,
|
static void untriggered_expectation( const std::string& context,
|
||||||
const std::string& file, int line )
|
const std::string& file, int line )
|
||||||
{
|
{
|
||||||
mock::detail::fail( "untriggered expectation", context,
|
fail( "untriggered expectation", context, file, line );
|
||||||
file, line );
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue