mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Better error diagnostic
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@69 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
a21ded7948
commit
d0bda73778
1 changed files with 17 additions and 9 deletions
|
|
@ -10,26 +10,34 @@
|
||||||
#define MOCK_TEST_SILENT_ERROR_HPP_INCLUDED
|
#define MOCK_TEST_SILENT_ERROR_HPP_INCLUDED
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <exception>
|
#include <sstream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace mock
|
namespace mock
|
||||||
{
|
{
|
||||||
template< typename Result >
|
template< typename Result >
|
||||||
struct silent_error
|
struct silent_error
|
||||||
{
|
{
|
||||||
static Result no_match( const std::string& /*context*/ )
|
static std::string to_string( int i )
|
||||||
{
|
{
|
||||||
throw std::exception();
|
std::stringstream s;
|
||||||
|
s << i;
|
||||||
|
return s.str();
|
||||||
}
|
}
|
||||||
static Result missing_result_specification( const std::string& /*context*/,
|
|
||||||
const std::string& /*file*/, int /*line*/ )
|
static Result no_match( const std::string& context )
|
||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::runtime_error( "no_match : " + context );
|
||||||
}
|
}
|
||||||
static void sequence_failed( const std::string& /*context*/,
|
static Result missing_result_specification( const std::string& context,
|
||||||
const std::string& /*file*/, int /*line*/ )
|
const std::string& file, int line )
|
||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::runtime_error( "missing_result_specification : " + context + " " + file + "(" + to_string( line ) + ")" );
|
||||||
|
}
|
||||||
|
static void sequence_failed( const std::string& context,
|
||||||
|
const std::string& file, int line )
|
||||||
|
{
|
||||||
|
throw std::runtime_error( "sequence_failed : " + context + " " + file + "(" + to_string( line ) + ")" );
|
||||||
}
|
}
|
||||||
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*/ )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue