mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Added NotImplementedException
This commit is contained in:
@@ -19,6 +19,30 @@ namespace Catch {
|
||||
|
||||
struct TestFailureException{};
|
||||
|
||||
class NotImplementedException : public std::exception
|
||||
{
|
||||
public:
|
||||
NotImplementedException( const SourceLineInfo& lineInfo )
|
||||
: m_lineInfo( lineInfo ) {
|
||||
std::ostringstream oss;
|
||||
oss << lineInfo << "function ";
|
||||
if( !lineInfo.function.empty() )
|
||||
oss << lineInfo.function << " ";
|
||||
oss << "not implemented";
|
||||
m_what = oss.str();
|
||||
}
|
||||
|
||||
virtual ~NotImplementedException() throw() {}
|
||||
|
||||
virtual const char* what() const throw() {
|
||||
return m_what.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_what;
|
||||
SourceLineInfo m_lineInfo;
|
||||
};
|
||||
|
||||
class ScopedInfo {
|
||||
public:
|
||||
ScopedInfo() : m_oss() {
|
||||
@@ -130,4 +154,7 @@ inline bool isTrue( bool value ){ return value; }
|
||||
throw; \
|
||||
}}while( Catch::isTrue( false ) )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define CATCH_NOT_IMPLEMENTED throw Catch::NotImplementedException( CATCH_INTERNAL_LINEINFO )
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
|
||||
|
@@ -82,6 +82,11 @@ namespace Catch {
|
||||
: file( _file ),
|
||||
line( _line )
|
||||
{}
|
||||
SourceLineInfo( const std::string& _function, const std::string& _file, std::size_t _line )
|
||||
: function( _function ),
|
||||
file( _file ),
|
||||
line( _line )
|
||||
{}
|
||||
SourceLineInfo( const SourceLineInfo& other )
|
||||
: file( other.file ),
|
||||
line( other.line )
|
||||
@@ -91,6 +96,7 @@ namespace Catch {
|
||||
std::swap( line, other.line );
|
||||
}
|
||||
|
||||
std::string function;
|
||||
std::string file;
|
||||
std::size_t line;
|
||||
};
|
||||
@@ -113,7 +119,12 @@ namespace Catch {
|
||||
}
|
||||
|
||||
#define CATCH_INTERNAL_ERROR( msg ) throwLogicError( msg, __FILE__, __LINE__ );
|
||||
|
||||
#ifdef __FUNCTION__
|
||||
#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FUNCTION__, __FILE__, __LINE__ )
|
||||
#else
|
||||
#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FILE__, __LINE__ )
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
|
||||
|
||||
|
@@ -81,8 +81,7 @@ namespace Catch {
|
||||
virtual void runAll( bool runHiddenTests = false ) {
|
||||
const std::vector<TestCaseInfo>& allTests = getCurrentContext().getTestCaseRegistry().getAllTests();
|
||||
for( std::size_t i=0; i < allTests.size(); ++i ) {
|
||||
if( runHiddenTests || !allTests[i].isHidden() )
|
||||
{
|
||||
if( runHiddenTests || !allTests[i].isHidden() ) {
|
||||
if( aborting() ) {
|
||||
m_reporter->Aborted();
|
||||
break;
|
||||
|
Reference in New Issue
Block a user