diff --git a/README.md b/README.md index 449d0a04..38e5c828 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![catch logo](catch-logo-small.png) -*v1.0 build 37 (master branch)* +*v1.0 build 38 (master branch)* Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) diff --git a/include/external/clara.h b/include/external/clara.h index 549bade5..d8e83ac5 100644 --- a/include/external/clara.h +++ b/include/external/clara.h @@ -251,6 +251,10 @@ namespace Clara { template struct IArgFunction { virtual ~IArgFunction() {} +# ifdef CATCH_CPP11_OR_GREATER + IArgFunction() = default; + IArgFunction( IArgFunction const& ) = default; +# endif virtual void set( ConfigT& config, std::string const& value ) const = 0; virtual void setFlag( ConfigT& config ) const = 0; virtual bool takesArg() const = 0; diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h index 7cfe4d83..adcc0215 100644 --- a/include/internal/catch_assertionresult.h +++ b/include/internal/catch_assertionresult.h @@ -41,6 +41,12 @@ namespace Catch { AssertionResult(); AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); ~AssertionResult(); +# ifdef CATCH_CPP11_OR_GREATER + AssertionResult( AssertionResult const& ) = default; + AssertionResult( AssertionResult && ) = default; + AssertionResult& operator = ( AssertionResult const& ) = default; + AssertionResult& operator = ( AssertionResult && ) = default; +# endif bool isOk() const; bool succeeded() const; diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index a823bd64..7fb88aed 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -78,6 +78,11 @@ namespace Catch { SourceLineInfo(); SourceLineInfo( char const* _file, std::size_t _line ); SourceLineInfo( SourceLineInfo const& other ); +# ifdef CATCH_CPP11_OR_GREATER + SourceLineInfo( SourceLineInfo && ) = default; + SourceLineInfo& operator = ( SourceLineInfo const& ) = default; + SourceLineInfo& operator = ( SourceLineInfo && ) = default; +# endif bool empty() const; bool operator == ( SourceLineInfo const& other ) const; diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index 6b8b89be..0baa2b5d 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -96,5 +96,28 @@ #endif +//////////////////////////////////////////////////////////////////////////////// +// C++ language feature support + +// detect language version: +#if (__cplusplus == 201103L) +# define CATCH_CPP11 +# define CATCH_CPP11_OR_GREATER +#elif (__cplusplus >= 201103L) +# define CATCH_CPP11_OR_GREATER +#endif + +// noexcept support: +#ifdef CATCH_CPP11_OR_GREATER +# if (__has_feature(cxx_noexcept)) +# define CATCH_NOEXCEPT noexcept +# define CATCH_NOEXCEPT_IS(x) noexcept(x) +# endif +#endif +#ifndef CATCH_NO_EXCEPT +# define CATCH_NOEXCEPT throw() +# define CATCH_NOEXCEPT_IS(x) +#endif + #endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED diff --git a/include/internal/catch_expression_lhs.hpp b/include/internal/catch_expression_lhs.hpp index 271e8dcb..81753fbc 100644 --- a/include/internal/catch_expression_lhs.hpp +++ b/include/internal/catch_expression_lhs.hpp @@ -14,14 +14,21 @@ namespace Catch { -// Wraps the LHS of an expression and captures the operator and RHS (if any) - wrapping them all -// in an ExpressionResultBuilder object +// Wraps the LHS of an expression and captures the operator and RHS (if any) - +// wrapping them all in an ExpressionResultBuilder object template class ExpressionLhs { - void operator = ( ExpressionLhs const& ); + ExpressionLhs& operator = ( ExpressionLhs const& ); +# ifdef CATCH_CPP11_OR_GREATER + ExpressionLhs& operator = ( ExpressionLhs && ) = delete; +# endif public: ExpressionLhs( T lhs ) : m_lhs( lhs ) {} +# ifdef CATCH_CPP11_OR_GREATER + ExpressionLhs( ExpressionLhs const& ) = default; + ExpressionLhs( ExpressionLhs && ) = default; +# endif template ExpressionResultBuilder& operator == ( RhsT const& rhs ) { diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp index e19c159f..3f836e45 100644 --- a/include/internal/catch_impl.hpp +++ b/include/internal/catch_impl.hpp @@ -42,7 +42,7 @@ namespace Catch { NonCopyable::~NonCopyable() {} IShared::~IShared() {} - StreamBufBase::~StreamBufBase() throw() {} + StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {} IContext::~IContext() {} IResultCapture::~IResultCapture() {} ITestCase::~ITestCase() {} diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index eafaaa3a..872b65c5 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -101,6 +101,13 @@ namespace Catch } virtual ~AssertionStats(); +# ifdef CATCH_CPP11_OR_GREATER + AssertionStats( AssertionStats const& ) = default; + AssertionStats( AssertionStats && ) = default; + AssertionStats& operator = ( AssertionStats const& ) = default; + AssertionStats& operator = ( AssertionStats && ) = default; +# endif + AssertionResult assertionResult; std::vector infoMessages; Totals totals; @@ -117,6 +124,12 @@ namespace Catch missingAssertions( _missingAssertions ) {} virtual ~SectionStats(); +# ifdef CATCH_CPP11_OR_GREATER + SectionStats( SectionStats const& ) = default; + SectionStats( SectionStats && ) = default; + SectionStats& operator = ( SectionStats const& ) = default; + SectionStats& operator = ( SectionStats && ) = default; +# endif SectionInfo sectionInfo; Counts assertions; @@ -138,6 +151,13 @@ namespace Catch {} virtual ~TestCaseStats(); +# ifdef CATCH_CPP11_OR_GREATER + TestCaseStats( TestCaseStats const& ) = default; + TestCaseStats( TestCaseStats && ) = default; + TestCaseStats& operator = ( TestCaseStats const& ) = default; + TestCaseStats& operator = ( TestCaseStats && ) = default; +# endif + TestCaseInfo testInfo; Totals totals; std::string stdOut; @@ -159,6 +179,13 @@ namespace Catch {} virtual ~TestGroupStats(); +# ifdef CATCH_CPP11_OR_GREATER + TestGroupStats( TestGroupStats const& ) = default; + TestGroupStats( TestGroupStats && ) = default; + TestGroupStats& operator = ( TestGroupStats const& ) = default; + TestGroupStats& operator = ( TestGroupStats && ) = default; +# endif + GroupInfo groupInfo; Totals totals; bool aborting; @@ -172,12 +199,20 @@ namespace Catch totals( _totals ), aborting( _aborting ) {} + virtual ~TestRunStats(); + +# ifndef CATCH_CPP11_OR_GREATER TestRunStats( TestRunStats const& _other ) : runInfo( _other.runInfo ), totals( _other.totals ), aborting( _other.aborting ) {} - virtual ~TestRunStats(); +# else + TestRunStats( TestRunStats const& ) = default; + TestRunStats( TestRunStats && ) = default; + TestRunStats& operator = ( TestRunStats const& ) = default; + TestRunStats& operator = ( TestRunStats && ) = default; +# endif TestRunInfo runInfo; Totals totals; diff --git a/include/internal/catch_notimplemented_exception.h b/include/internal/catch_notimplemented_exception.h index e543bdaf..84b1cf3f 100644 --- a/include/internal/catch_notimplemented_exception.h +++ b/include/internal/catch_notimplemented_exception.h @@ -18,9 +18,9 @@ namespace Catch { public: NotImplementedException( SourceLineInfo const& lineInfo ); - virtual ~NotImplementedException() throw() {} + virtual ~NotImplementedException() CATCH_NOEXCEPT {} - virtual const char* what() const throw(); + virtual const char* what() const CATCH_NOEXCEPT; private: std::string m_what; diff --git a/include/internal/catch_notimplemented_exception.hpp b/include/internal/catch_notimplemented_exception.hpp index 4683dcc1..4d263f1b 100644 --- a/include/internal/catch_notimplemented_exception.hpp +++ b/include/internal/catch_notimplemented_exception.hpp @@ -21,7 +21,7 @@ namespace Catch { m_what = oss.str(); } - const char* NotImplementedException::what() const throw() { + const char* NotImplementedException::what() const CATCH_NOEXCEPT { return m_what.c_str(); } diff --git a/include/internal/catch_section.h b/include/internal/catch_section.h index c1a81f6f..39211ed9 100644 --- a/include/internal/catch_section.h +++ b/include/internal/catch_section.h @@ -22,6 +22,12 @@ namespace Catch { std::string const& name, std::string const& description = "" ); ~Section(); +# ifdef CATCH_CPP11_OR_GREATER + Section( Section const& ) = default; + Section( Section && ) = default; + Section& operator = ( Section const& ) = default; + Section& operator = ( Section && ) = default; +# endif // This indicates whether the section should be executed or not operator bool(); diff --git a/include/internal/catch_stream.hpp b/include/internal/catch_stream.hpp index 784ef86b..adfacbf1 100644 --- a/include/internal/catch_stream.hpp +++ b/include/internal/catch_stream.hpp @@ -28,7 +28,7 @@ namespace Catch { setp( data, data + sizeof(data) ); } - ~StreamBufImpl() throw() { + ~StreamBufImpl() CATCH_NOEXCEPT { sync(); } diff --git a/include/internal/catch_streambuf.h b/include/internal/catch_streambuf.h index 6a601dbd..4f5e238c 100644 --- a/include/internal/catch_streambuf.h +++ b/include/internal/catch_streambuf.h @@ -8,13 +8,15 @@ #ifndef TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED #define TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED +#include "catch_compiler_capabilities.h" + #include namespace Catch { class StreamBufBase : public std::streambuf { public: - virtual ~StreamBufBase() throw(); + virtual ~StreamBufBase() CATCH_NOEXCEPT; }; } diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp index adcedd9b..7625293d 100644 --- a/include/internal/catch_version.hpp +++ b/include/internal/catch_version.hpp @@ -13,7 +13,7 @@ namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 0, 37, "master" ); + Version libraryVersion( 1, 0, 38, "master" ); } #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp index 5593022c..3b19b945 100644 --- a/include/internal/catch_xmlwriter.hpp +++ b/include/internal/catch_xmlwriter.hpp @@ -66,11 +66,18 @@ namespace Catch { endElement(); } +# ifndef CATCH_CPP11_OR_GREATER XmlWriter& operator = ( XmlWriter const& other ) { XmlWriter temp( other ); swap( temp ); return *this; } +# else + XmlWriter( XmlWriter const& ) = default; + XmlWriter( XmlWriter && ) = default; + XmlWriter& operator = ( XmlWriter const& ) = default; + XmlWriter& operator = ( XmlWriter && ) = default; +# endif void swap( XmlWriter& other ) { std::swap( m_tagIsOpen, other.m_tagIsOpen ); diff --git a/single_include/catch.hpp b/single_include/catch.hpp index 9dace59e..3b261aa5 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,6 +1,6 @@ /* - * CATCH v1.0 build 37 (master branch) - * Generated: 2014-04-18 08:30:06.534609 + * CATCH v1.0 build 38 (master branch) + * Generated: 2014-04-18 08:47:21.504017 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -139,6 +139,29 @@ #endif +//////////////////////////////////////////////////////////////////////////////// +// C++ language feature support + +// detect language version: +#if (__cplusplus == 201103L) +# define CATCH_CPP11 +# define CATCH_CPP11_OR_GREATER +#elif (__cplusplus >= 201103L) +# define CATCH_CPP11_OR_GREATER +#endif + +// noexcept support: +#ifdef CATCH_CPP11_OR_GREATER +# if (__has_feature(cxx_noexcept)) +# define CATCH_NOEXCEPT noexcept +# define CATCH_NOEXCEPT_IS(x) noexcept(x) +# endif +#endif +#ifndef CATCH_NO_EXCEPT +# define CATCH_NOEXCEPT throw() +# define CATCH_NOEXCEPT_IS(x) +#endif + namespace Catch { class NonCopyable { @@ -196,6 +219,11 @@ namespace Catch { SourceLineInfo(); SourceLineInfo( char const* _file, std::size_t _line ); SourceLineInfo( SourceLineInfo const& other ); +# ifdef CATCH_CPP11_OR_GREATER + SourceLineInfo( SourceLineInfo && ) = default; + SourceLineInfo& operator = ( SourceLineInfo const& ) = default; + SourceLineInfo& operator = ( SourceLineInfo && ) = default; +# endif bool empty() const; bool operator == ( SourceLineInfo const& other ) const; @@ -237,9 +265,9 @@ namespace Catch { public: NotImplementedException( SourceLineInfo const& lineInfo ); - virtual ~NotImplementedException() throw() {} + virtual ~NotImplementedException() CATCH_NOEXCEPT {} - virtual const char* what() const throw(); + virtual const char* what() const CATCH_NOEXCEPT; private: std::string m_what; @@ -982,6 +1010,12 @@ namespace Catch { AssertionResult(); AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); ~AssertionResult(); +# ifdef CATCH_CPP11_OR_GREATER + AssertionResult( AssertionResult const& ) = default; + AssertionResult( AssertionResult && ) = default; + AssertionResult& operator = ( AssertionResult const& ) = default; + AssertionResult& operator = ( AssertionResult && ) = default; +# endif bool isOk() const; bool succeeded() const; @@ -1220,14 +1254,21 @@ private: namespace Catch { -// Wraps the LHS of an expression and captures the operator and RHS (if any) - wrapping them all -// in an ExpressionResultBuilder object +// Wraps the LHS of an expression and captures the operator and RHS (if any) - +// wrapping them all in an ExpressionResultBuilder object template class ExpressionLhs { - void operator = ( ExpressionLhs const& ); + ExpressionLhs& operator = ( ExpressionLhs const& ); +# ifdef CATCH_CPP11_OR_GREATER + ExpressionLhs& operator = ( ExpressionLhs && ) = delete; +# endif public: ExpressionLhs( T lhs ) : m_lhs( lhs ) {} +# ifdef CATCH_CPP11_OR_GREATER + ExpressionLhs( ExpressionLhs const& ) = default; + ExpressionLhs( ExpressionLhs && ) = default; +# endif template ExpressionResultBuilder& operator == ( RhsT const& rhs ) { @@ -1810,6 +1851,12 @@ namespace Catch { std::string const& name, std::string const& description = "" ); ~Section(); +# ifdef CATCH_CPP11_OR_GREATER + Section( Section const& ) = default; + Section( Section && ) = default; + Section& operator = ( Section const& ) = default; + Section& operator = ( Section && ) = default; +# endif // This indicates whether the section should be executed or not operator bool(); @@ -3265,6 +3312,10 @@ namespace Clara { template struct IArgFunction { virtual ~IArgFunction() {} +# ifdef CATCH_CPP11_OR_GREATER + IArgFunction() = default; + IArgFunction( IArgFunction const& ) = default; +# endif virtual void set( ConfigT& config, std::string const& value ) const = 0; virtual void setFlag( ConfigT& config ) const = 0; virtual bool takesArg() const = 0; @@ -4379,6 +4430,13 @@ namespace Catch } virtual ~AssertionStats(); +# ifdef CATCH_CPP11_OR_GREATER + AssertionStats( AssertionStats const& ) = default; + AssertionStats( AssertionStats && ) = default; + AssertionStats& operator = ( AssertionStats const& ) = default; + AssertionStats& operator = ( AssertionStats && ) = default; +# endif + AssertionResult assertionResult; std::vector infoMessages; Totals totals; @@ -4395,6 +4453,12 @@ namespace Catch missingAssertions( _missingAssertions ) {} virtual ~SectionStats(); +# ifdef CATCH_CPP11_OR_GREATER + SectionStats( SectionStats const& ) = default; + SectionStats( SectionStats && ) = default; + SectionStats& operator = ( SectionStats const& ) = default; + SectionStats& operator = ( SectionStats && ) = default; +# endif SectionInfo sectionInfo; Counts assertions; @@ -4416,6 +4480,13 @@ namespace Catch {} virtual ~TestCaseStats(); +# ifdef CATCH_CPP11_OR_GREATER + TestCaseStats( TestCaseStats const& ) = default; + TestCaseStats( TestCaseStats && ) = default; + TestCaseStats& operator = ( TestCaseStats const& ) = default; + TestCaseStats& operator = ( TestCaseStats && ) = default; +# endif + TestCaseInfo testInfo; Totals totals; std::string stdOut; @@ -4437,6 +4508,13 @@ namespace Catch {} virtual ~TestGroupStats(); +# ifdef CATCH_CPP11_OR_GREATER + TestGroupStats( TestGroupStats const& ) = default; + TestGroupStats( TestGroupStats && ) = default; + TestGroupStats& operator = ( TestGroupStats const& ) = default; + TestGroupStats& operator = ( TestGroupStats && ) = default; +# endif + GroupInfo groupInfo; Totals totals; bool aborting; @@ -4450,12 +4528,20 @@ namespace Catch totals( _totals ), aborting( _aborting ) {} + virtual ~TestRunStats(); + +# ifndef CATCH_CPP11_OR_GREATER TestRunStats( TestRunStats const& _other ) : runInfo( _other.runInfo ), totals( _other.totals ), aborting( _other.aborting ) {} - virtual ~TestRunStats(); +# else + TestRunStats( TestRunStats const& ) = default; + TestRunStats( TestRunStats && ) = default; + TestRunStats& operator = ( TestRunStats const& ) = default; + TestRunStats& operator = ( TestRunStats && ) = default; +# endif TestRunInfo runInfo; Totals totals; @@ -5625,7 +5711,7 @@ namespace Catch { m_what = oss.str(); } - const char* NotImplementedException::what() const throw() { + const char* NotImplementedException::what() const CATCH_NOEXCEPT { return m_what.c_str(); } @@ -5646,7 +5732,7 @@ namespace Catch { class StreamBufBase : public std::streambuf { public: - virtual ~StreamBufBase() throw(); + virtual ~StreamBufBase() CATCH_NOEXCEPT; }; } @@ -5665,7 +5751,7 @@ namespace Catch { setp( data, data + sizeof(data) ); } - ~StreamBufImpl() throw() { + ~StreamBufImpl() CATCH_NOEXCEPT { sync(); } @@ -6616,7 +6702,7 @@ namespace Catch { namespace Catch { // These numbers are maintained by a script - Version libraryVersion( 1, 0, 37, "master" ); + Version libraryVersion( 1, 0, 38, "master" ); } // #included from: catch_message.hpp @@ -7334,11 +7420,18 @@ namespace Catch { endElement(); } +# ifndef CATCH_CPP11_OR_GREATER XmlWriter& operator = ( XmlWriter const& other ) { XmlWriter temp( other ); swap( temp ); return *this; } +# else + XmlWriter( XmlWriter const& ) = default; + XmlWriter( XmlWriter && ) = default; + XmlWriter& operator = ( XmlWriter const& ) = default; + XmlWriter& operator = ( XmlWriter && ) = default; +# endif void swap( XmlWriter& other ) { std::swap( m_tagIsOpen, other.m_tagIsOpen ); @@ -8223,7 +8316,7 @@ namespace Catch { namespace Catch { NonCopyable::~NonCopyable() {} IShared::~IShared() {} - StreamBufBase::~StreamBufBase() throw() {} + StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {} IContext::~IContext() {} IResultCapture::~IResultCapture() {} ITestCase::~ITestCase() {}