Initial support for variadic macros

This commit is contained in:
Phil Nash 2013-03-16 20:18:52 +00:00
parent 9c5bbab239
commit c0b698073e
6 changed files with 163 additions and 63 deletions

View file

@ -17,9 +17,9 @@ namespace Catch {
class Section {
public:
Section( const std::string& name,
const std::string& description,
const SourceLineInfo& lineInfo )
Section( const SourceLineInfo& lineInfo,
const std::string& name,
const std::string& description = "" )
: m_info( name, description, lineInfo ),
m_sectionIncluded( getCurrentContext().getResultCapture().sectionStarted( m_info, m_assertions ) )
{}
@ -44,7 +44,12 @@ namespace Catch {
} // end namespace Catch
#define INTERNAL_CATCH_SECTION( name, desc ) \
if( Catch::Section INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( name, desc, CATCH_INTERNAL_LINEINFO ) )
#ifdef CATCH_CONFIG_VARIADIC_MACROS
#define INTERNAL_CATCH_SECTION( ... ) \
if( Catch::Section INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
#else
#define INTERNAL_CATCH_SECTION( name, desc ) \
if( Catch::Section INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( CATCH_INTERNAL_LINEINFO, name, desc ) )
#endif
#endif // TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED