Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorPhil Nash2012-07-05 18:37:58 +0100
committerPhil Nash2012-07-05 18:37:58 +0100
commitabf271672f89f0540bd81f6df11ef5b7eacb737e (patch)
tree68f35d809197068369a606df0e8a162dbb7016e8 /include
parent4c73aa5a0ed8ebe621a50aab279f33bfb731b4f5 (diff)
downloadcatch3-abf271672f89f0540bd81f6df11ef5b7eacb737e.tar.gz
Added NotImplementedException
Diffstat (limited to 'include')
-rw-r--r--include/catch_runner.hpp3
-rw-r--r--include/internal/catch_capture.hpp27
-rw-r--r--include/internal/catch_common.h11
-rw-r--r--include/internal/catch_runner_impl.hpp3
4 files changed, 41 insertions, 3 deletions
diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp
index 4164a0e6..0e087206 100644
--- a/include/catch_runner.hpp
+++ b/include/catch_runner.hpp
@@ -77,7 +77,8 @@ namespace Catch {
}
inline void showUsage( std::ostream& os ) {
- os << "\t-l, --list <tests | reporters> [xml]\n"
+ os << "\t-?, -h, --help\n"
+ << "\t-l, --list <tests | reporters> [xml]\n"
<< "\t-t, --test <testspec> [<testspec>...]\n"
<< "\t-r, --reporter <reporter name>\n"
<< "\t-o, --out <file name>|<%stream name>\n"
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp
index 41f0f9d8..edb75101 100644
--- a/include/internal/catch_capture.hpp
+++ b/include/internal/catch_capture.hpp
@@ -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
diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h
index e3b28ca6..9936e0ac 100644
--- a/include/internal/catch_common.h
+++ b/include/internal/catch_common.h
@@ -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
diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp
index 885bd61d..bcca0392 100644
--- a/include/internal/catch_runner_impl.hpp
+++ b/include/internal/catch_runner_impl.hpp
@@ -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;