diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea35d24e..66091046 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ if(NOT DEFINED PROJECT_NAME)
set(NOT_SUBPROJECT ON)
endif()
-project(Catch2 LANGUAGES CXX VERSION 2.7.0)
+project(Catch2 LANGUAGES CXX VERSION 2.7.1)
# Provide path for scripts
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
diff --git a/README.md b/README.md
index b4d997d0..a09ad44b 100644
--- a/README.md
+++ b/README.md
@@ -5,11 +5,11 @@
[](https://travis-ci.org/catchorg/Catch2)
[](https://ci.appveyor.com/project/catchorg/catch2)
[](https://codecov.io/gh/catchorg/Catch2)
-[](https://wandbox.org/permlink/byNJIivVphHo170P)
+[](https://wandbox.org/permlink/ZFBZ5XbLA9F1gzKi)
[](https://discord.gg/4CWS9zD)
-The latest version of the single header can be downloaded directly using this link
+The latest version of the single header can be downloaded directly using this link
## Catch2 is released!
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 34278c38..655eb741 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -2,6 +2,7 @@
# Release notes
**Contents**
+[2.7.1](#271)
[2.7.0](#270)
[2.6.1](#261)
[2.6.0](#260)
@@ -21,6 +22,19 @@
[Older versions](#older-versions)
[Even Older versions](#even-older-versions)
+## 2.7.1
+
+### Improvements
+* Reporters now print out the filters applied to test cases (#1550, #1585)
+* Added `GENERATE_COPY` and `GENERATE_VAR` macros that can use variables inside the generator expression
+ * Because of the significant danger of lifetime issues, the default `GENERATE` macro still does not allow variables
+* The `map` generator helper now deduces the mapped return type (#1576)
+
+### Fixes
+* Fixed ObjC++ compilation (#1571)
+* Fixed test tag parsing so that `[.foo]` is now parsed as `[.][foo]`.
+* Suppressed warning caused by the Windows headers defining SE codes in different manners (#1575)
+
## 2.7.0
### Improvements
diff --git a/include/catch.hpp b/include/catch.hpp
index e15588f0..5ee7ffdd 100644
--- a/include/catch.hpp
+++ b/include/catch.hpp
@@ -11,7 +11,7 @@
#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 7
-#define CATCH_VERSION_PATCH 0
+#define CATCH_VERSION_PATCH 1
#ifdef __clang__
# pragma clang system_header
diff --git a/include/internal/catch_version.cpp b/include/internal/catch_version.cpp
index a1d08b2c..43832053 100644
--- a/include/internal/catch_version.cpp
+++ b/include/internal/catch_version.cpp
@@ -37,7 +37,7 @@ namespace Catch {
}
Version const& libraryVersion() {
- static Version version( 2, 7, 0, "", 0 );
+ static Version version( 2, 7, 1, "", 0 );
return version;
}
diff --git a/single_include/catch2/catch.hpp b/single_include/catch2/catch.hpp
index 1850fff1..98672c07 100644
--- a/single_include/catch2/catch.hpp
+++ b/single_include/catch2/catch.hpp
@@ -1,6 +1,6 @@
/*
- * Catch v2.7.0
- * Generated: 2019-03-07 21:34:30.252164
+ * Catch v2.7.1
+ * Generated: 2019-04-05 18:22:37.720122
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved.
@@ -15,7 +15,7 @@
#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 7
-#define CATCH_VERSION_PATCH 0
+#define CATCH_VERSION_PATCH 1
#ifdef __clang__
# pragma clang system_header
@@ -3686,7 +3686,11 @@ namespace Generators {
} // namespace Catch
#define GENERATE( ... ) \
- Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, []{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } )
+ Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } )
+#define GENERATE_COPY( ... ) \
+ Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } )
+#define GENERATE_REF( ... ) \
+ Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } )
// end catch_generators.hpp
// start catch_generators_generic.hpp
@@ -3849,16 +3853,28 @@ namespace Generators {
}
};
- template
+#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703
+ // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is
+ // replaced with std::invoke_result here. Also *_t format is preferred over
+ // typename *::type format.
+ template
+ using MapFunctionReturnType = std::remove_reference_t>>;
+#else
+ template
+ using MapFunctionReturnType = typename std::remove_reference::type>::type>::type;
+#endif
+
+ template >
GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) {
return GeneratorWrapper(
pf::make_unique>(std::forward(function), std::move(generator))
);
}
- template
- GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) {
+
+ template
+ GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) {
return GeneratorWrapper(
- pf::make_unique>(std::forward(function), std::move(generator))
+ pf::make_unique>(std::forward(function), std::move(generator))
);
}
@@ -4022,6 +4038,7 @@ namespace Catch {
virtual ShowDurations::OrNot showDurations() const = 0;
virtual TestSpec const& testSpec() const = 0;
virtual bool hasTestFilters() const = 0;
+ virtual std::vector const& getTestsOrTags() const = 0;
virtual RunTests::InWhatOrder runOrder() const = 0;
virtual unsigned int rngSeed() const = 0;
virtual int benchmarkResolutionMultiple() const = 0;
@@ -4352,7 +4369,7 @@ namespace Catch {
arcSafeRelease( m_substr );
}
- bool match( NSString* arg ) const override {
+ bool match( NSString* const& str ) const override {
return false;
}
@@ -4362,7 +4379,7 @@ namespace Catch {
struct Equals : StringHolder {
Equals( NSString* substr ) : StringHolder( substr ){}
- bool match( NSString* str ) const override {
+ bool match( NSString* const& str ) const override {
return (str != nil || m_substr == nil ) &&
[str isEqualToString:m_substr];
}
@@ -4375,7 +4392,7 @@ namespace Catch {
struct Contains : StringHolder {
Contains( NSString* substr ) : StringHolder( substr ){}
- bool match( NSString* str ) const {
+ bool match( NSString* const& str ) const override {
return (str != nil || m_substr == nil ) &&
[str rangeOfString:m_substr].location != NSNotFound;
}
@@ -4388,7 +4405,7 @@ namespace Catch {
struct StartsWith : StringHolder {
StartsWith( NSString* substr ) : StringHolder( substr ){}
- bool match( NSString* str ) const override {
+ bool match( NSString* const& str ) const override {
return (str != nil || m_substr == nil ) &&
[str rangeOfString:m_substr].location == 0;
}
@@ -4400,7 +4417,7 @@ namespace Catch {
struct EndsWith : StringHolder {
EndsWith( NSString* substr ) : StringHolder( substr ){}
- bool match( NSString* str ) const override {
+ bool match( NSString* const& str ) const override {
return (str != nil || m_substr == nil ) &&
[str rangeOfString:m_substr].location == [str length] - [m_substr length];
}
@@ -4708,7 +4725,7 @@ namespace Catch {
std::string getProcessName() const;
std::string const& getReporterName() const;
- std::vector const& getTestsOrTags() const;
+ std::vector const& getTestsOrTags() const override;
std::vector const& getSectionsToRun() const override;
virtual TestSpec const& testSpec() const override;
@@ -5082,6 +5099,8 @@ namespace Catch {
// Returns double formatted as %.3f (format expected on output)
std::string getFormattedDuration( double duration );
+ std::string serializeFilters( std::vector const& container );
+
template
struct StreamingReporterBase : IStreamingReporter {
@@ -5109,6 +5128,7 @@ namespace Catch {
void testRunStarting(TestRunInfo const& _testRunInfo) override {
currentTestRunInfo = _testRunInfo;
}
+
void testGroupStarting(GroupInfo const& _groupInfo) override {
currentGroupInfo = _groupInfo;
}
@@ -5521,7 +5541,7 @@ namespace Catch {
void testCaseEnded(TestCaseStats const& _testCaseStats) override;
void testGroupEnded(TestGroupStats const& _testGroupStats) override;
void testRunEnded(TestRunStats const& _testRunStats) override;
-
+ void testRunStarting(TestRunInfo const& _testRunInfo) override;
private:
void lazyPrint();
@@ -5543,6 +5563,7 @@ namespace Catch {
void printTotalsDivider(Totals const& totals);
void printSummaryDivider();
+ void printTestFilters();
private:
bool m_headerPrinted = false;
@@ -8660,10 +8681,10 @@ namespace Catch {
// Windows can easily distinguish between SO and SigSegV,
// but SigInt, SigTerm, etc are handled differently.
static SignalDefs signalDefs[] = {
- { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" },
- { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" },
- { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" },
- { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" },
+ { static_cast(EXCEPTION_ILLEGAL_INSTRUCTION), "SIGILL - Illegal instruction signal" },
+ { static_cast(EXCEPTION_STACK_OVERFLOW), "SIGSEGV - Stack overflow" },
+ { static_cast(EXCEPTION_ACCESS_VIOLATION), "SIGSEGV - Segmentation violation signal" },
+ { static_cast(EXCEPTION_INT_DIVIDE_BY_ZERO), "Divide by zero error" },
};
LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
@@ -11657,6 +11678,12 @@ namespace Catch {
else if( prop == TestCaseInfo::None )
enforceNotReservedTag( tag, _lineInfo );
+ // Merged hide tags like `[.approvals]` should be added as
+ // `[.][approvals]`. The `[.]` is added at later point, so
+ // we only strip the prefix
+ if (startsWith(tag, '.') && tag.size() > 1) {
+ tag.erase(0, 1);
+ }
tags.push_back( tag );
tag.clear();
inTag = false;
@@ -12665,7 +12692,7 @@ namespace Catch {
}
Version const& libraryVersion() {
- static Version version( 2, 7, 0, "", 0 );
+ static Version version( 2, 7, 1, "", 0 );
return version;
}
@@ -13022,6 +13049,21 @@ namespace Catch {
return std::string(buffer);
}
+ std::string serializeFilters( std::vector const& container ) {
+ ReusableStringStream oss;
+ bool first = true;
+ for (auto&& filter : container)
+ {
+ if (!first)
+ oss << ' ';
+ else
+ first = false;
+
+ oss << filter;
+ }
+ return oss.str();
+ }
+
TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)
:StreamingReporterBase(_config) {}
@@ -13746,6 +13788,10 @@ void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
stream << std::endl;
StreamingReporterBase::testRunEnded(_testRunStats);
}
+void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) {
+ StreamingReporterBase::testRunStarting(_testInfo);
+ printTestFilters();
+}
void ConsoleReporter::lazyPrint() {
@@ -13927,6 +13973,11 @@ void ConsoleReporter::printSummaryDivider() {
stream << getLineOfChars<'-'>() << '\n';
}
+void ConsoleReporter::printTestFilters() {
+ if (m_config->testSpec().hasFilters())
+ stream << Colour(Colour::BrightYellow) << "Filters: " << serializeFilters( m_config->getTestsOrTags() ) << '\n';
+}
+
CATCH_REGISTER_REPORTER("console", ConsoleReporter)
} // end namespace Catch
@@ -14000,8 +14051,17 @@ namespace Catch {
void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) {
CumulativeReporterBase::testRunStarting( runInfo );
xml.startElement( "testsuites" );
+
+ if ( m_config->hasTestFilters() || m_config->rngSeed() != 0 )
+ xml.startElement("properties");
+
+ if ( m_config->hasTestFilters() ) {
+ xml.scopedElement( "property" )
+ .writeAttribute( "name" , "filters" )
+ .writeAttribute( "value" , serializeFilters( m_config->getTestsOrTags() ) );
+ }
+
if( m_config->rngSeed() != 0 ) {
- xml.startElement( "properties" );
xml.scopedElement( "property" )
.writeAttribute( "name", "random-seed" )
.writeAttribute( "value", m_config->rngSeed() );
@@ -14357,6 +14417,8 @@ namespace Catch {
m_xml.startElement( "Catch" );
if( !m_config->name().empty() )
m_xml.writeAttribute( "name", m_config->name() );
+ if (m_config->testSpec().hasFilters())
+ m_xml.writeAttribute( "filters", serializeFilters( m_config->getTestsOrTags() ) );
if( m_config->rngSeed() != 0 )
m_xml.scopedElement( "Randomness" )
.writeAttribute( "seed", m_config->rngSeed() );