mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Use explicit streaming ops instead of Boost.LexicalCast
This commit is contained in:
parent
898a5a4524
commit
04dff97fde
5 changed files with 24 additions and 17 deletions
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
#define MOCK_ERROR_POLICY mock_error
|
||||
#include <turtle/detail/singleton.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
struct mock_error_data_t : mock::detail::singleton< mock_error_data_t >
|
||||
{
|
||||
|
|
@ -68,18 +68,17 @@ struct mock_error
|
|||
{}
|
||||
|
||||
template< typename Context >
|
||||
static void call( const Context& /*context*/,
|
||||
const char* /*file*/, int /*line*/ )
|
||||
static void call( const Context& /*context*/, const char* /*file*/, int /*line*/ )
|
||||
{
|
||||
mock_error_data.call();
|
||||
}
|
||||
|
||||
template< typename Context >
|
||||
static void fail( const std::string& message, const Context& context,
|
||||
const char* file = "", int line = 0 )
|
||||
static void fail( const std::string& message, const Context& context, const char* file = "", int line = 0 )
|
||||
{
|
||||
mock_error_data.fail( message,
|
||||
boost::lexical_cast< std::string >( context ), file, line );
|
||||
std::ostringstream s;
|
||||
s << context; // Context can be streamed
|
||||
mock_error_data.fail( message, s.str(), file, line );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue