Use explicit streaming ops instead of Boost.LexicalCast

This commit is contained in:
Alexander Grund 2020-07-12 13:38:54 +02:00
parent 898a5a4524
commit 04dff97fde
No known key found for this signature in database
GPG key ID: AA48A0760367A42B
5 changed files with 24 additions and 17 deletions

View file

@ -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 );
}
};