mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
v2.7.2
This commit is contained in:
parent
4a1ca1ab55
commit
7c37501b07
@ -6,7 +6,7 @@ if(NOT DEFINED PROJECT_NAME)
|
|||||||
set(NOT_SUBPROJECT ON)
|
set(NOT_SUBPROJECT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(Catch2 LANGUAGES CXX VERSION 2.7.1)
|
project(Catch2 LANGUAGES CXX VERSION 2.7.2)
|
||||||
|
|
||||||
# Provide path for scripts
|
# Provide path for scripts
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
[![Build Status](https://travis-ci.org/catchorg/Catch2.svg?branch=master)](https://travis-ci.org/catchorg/Catch2)
|
[![Build Status](https://travis-ci.org/catchorg/Catch2.svg?branch=master)](https://travis-ci.org/catchorg/Catch2)
|
||||||
[![Build status](https://ci.appveyor.com/api/projects/status/github/catchorg/Catch2?svg=true)](https://ci.appveyor.com/project/catchorg/catch2)
|
[![Build status](https://ci.appveyor.com/api/projects/status/github/catchorg/Catch2?svg=true)](https://ci.appveyor.com/project/catchorg/catch2)
|
||||||
[![codecov](https://codecov.io/gh/catchorg/Catch2/branch/master/graph/badge.svg)](https://codecov.io/gh/catchorg/Catch2)
|
[![codecov](https://codecov.io/gh/catchorg/Catch2/branch/master/graph/badge.svg)](https://codecov.io/gh/catchorg/Catch2)
|
||||||
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/ZFBZ5XbLA9F1gzKi)
|
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/rsEsNO9M0flb5NlQ)
|
||||||
[![Join the chat in Discord: https://discord.gg/4CWS9zD](https://img.shields.io/badge/Discord-Chat!-brightgreen.svg)](https://discord.gg/4CWS9zD)
|
[![Join the chat in Discord: https://discord.gg/4CWS9zD](https://img.shields.io/badge/Discord-Chat!-brightgreen.svg)](https://discord.gg/4CWS9zD)
|
||||||
|
|
||||||
|
|
||||||
<a href="https://github.com/catchorg/Catch2/releases/download/v2.7.1/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
<a href="https://github.com/catchorg/Catch2/releases/download/v2.7.2/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
||||||
|
|
||||||
## Catch2 is released!
|
## Catch2 is released!
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# Release notes
|
# Release notes
|
||||||
**Contents**<br>
|
**Contents**<br>
|
||||||
|
[2.7.2](#272)<br>
|
||||||
[2.7.1](#271)<br>
|
[2.7.1](#271)<br>
|
||||||
[2.7.0](#270)<br>
|
[2.7.0](#270)<br>
|
||||||
[2.6.1](#261)<br>
|
[2.6.1](#261)<br>
|
||||||
@ -22,6 +23,28 @@
|
|||||||
[Older versions](#older-versions)<br>
|
[Older versions](#older-versions)<br>
|
||||||
[Even Older versions](#even-older-versions)<br>
|
[Even Older versions](#even-older-versions)<br>
|
||||||
|
|
||||||
|
|
||||||
|
## 2.7.2
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
* Added an approximate vector matcher (#1499)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
* Filters will no longer be shown if there were none
|
||||||
|
* Fixed compilation error when using Homebrew GCC on OS X (#1588, #1589)
|
||||||
|
* Fixed the console reporter not showing messages that start with a newline (#1455, #1470)
|
||||||
|
* Modified JUnit reporter's output so that rng seed and filters are reported according to the JUnit schema (#1598)
|
||||||
|
* Fixed some obscure warnings and static analysis passes
|
||||||
|
|
||||||
|
### Miscellaneous
|
||||||
|
* Various improvements to `ParseAndAddCatchTests` (#1559, #1601)
|
||||||
|
* When a target is parsed, it receives `ParseAndAddCatchTests_TESTS` property which summarizes found tests
|
||||||
|
* Fixed problem with tests not being found if the `OptionalCatchTestLauncher` variables is used
|
||||||
|
* Including the script will no longer forcefully modify `CMAKE_MINIMUM_REQUIRED_VERSION`
|
||||||
|
* CMake object libraries are ignored when parsing to avoid needless warnings
|
||||||
|
* `CatchAddTests` now adds test's tags to their CTest labels (#1600)
|
||||||
|
* Added basic CPack support to our build
|
||||||
|
|
||||||
## 2.7.1
|
## 2.7.1
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#define CATCH_VERSION_MAJOR 2
|
#define CATCH_VERSION_MAJOR 2
|
||||||
#define CATCH_VERSION_MINOR 7
|
#define CATCH_VERSION_MINOR 7
|
||||||
#define CATCH_VERSION_PATCH 1
|
#define CATCH_VERSION_PATCH 2
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
# pragma clang system_header
|
# pragma clang system_header
|
||||||
|
@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 7, 1, "", 0 );
|
static Version version( 2, 7, 2, "", 0 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v2.7.1
|
* Catch v2.7.2
|
||||||
* Generated: 2019-04-05 18:22:37.720122
|
* Generated: 2019-04-22 23:13:14.687465
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* This file has been merged from multiple headers. Please don't edit it directly
|
* This file has been merged from multiple headers. Please don't edit it directly
|
||||||
* Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#define CATCH_VERSION_MAJOR 2
|
#define CATCH_VERSION_MAJOR 2
|
||||||
#define CATCH_VERSION_MINOR 7
|
#define CATCH_VERSION_MINOR 7
|
||||||
#define CATCH_VERSION_PATCH 1
|
#define CATCH_VERSION_PATCH 2
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
# pragma clang system_header
|
# pragma clang system_header
|
||||||
@ -3113,7 +3113,7 @@ public:
|
|||||||
|
|
||||||
// The following functions create the actual matcher objects.
|
// The following functions create the actual matcher objects.
|
||||||
// The user has to explicitly specify type to the function, because
|
// The user has to explicitly specify type to the function, because
|
||||||
// infering std::function<bool(T const&)> is hard (but possible) and
|
// inferring std::function<bool(T const&)> is hard (but possible) and
|
||||||
// requires a lot of TMP.
|
// requires a lot of TMP.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Generic::PredicateMatcher<T> Predicate(std::function<bool(T const&)> const& predicate, std::string const& description = "") {
|
Generic::PredicateMatcher<T> Predicate(std::function<bool(T const&)> const& predicate, std::string const& description = "") {
|
||||||
@ -3201,28 +3201,6 @@ namespace Catch {
|
|||||||
namespace Matchers {
|
namespace Matchers {
|
||||||
|
|
||||||
namespace Vector {
|
namespace Vector {
|
||||||
namespace Detail {
|
|
||||||
template <typename InputIterator, typename T>
|
|
||||||
size_t count(InputIterator first, InputIterator last, T const& item) {
|
|
||||||
size_t cnt = 0;
|
|
||||||
for (; first != last; ++first) {
|
|
||||||
if (*first == item) {
|
|
||||||
++cnt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cnt;
|
|
||||||
}
|
|
||||||
template <typename InputIterator, typename T>
|
|
||||||
bool contains(InputIterator first, InputIterator last, T const& item) {
|
|
||||||
for (; first != last; ++first) {
|
|
||||||
if (*first == item) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ContainsElementMatcher : MatcherBase<std::vector<T>> {
|
struct ContainsElementMatcher : MatcherBase<std::vector<T>> {
|
||||||
|
|
||||||
@ -3297,6 +3275,42 @@ namespace Matchers {
|
|||||||
std::vector<T> const& m_comparator;
|
std::vector<T> const& m_comparator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct ApproxMatcher : MatcherBase<std::vector<T>> {
|
||||||
|
|
||||||
|
ApproxMatcher(std::vector<T> const& comparator) : m_comparator( comparator ) {}
|
||||||
|
|
||||||
|
bool match(std::vector<T> const &v) const override {
|
||||||
|
if (m_comparator.size() != v.size())
|
||||||
|
return false;
|
||||||
|
for (std::size_t i = 0; i < v.size(); ++i)
|
||||||
|
if (m_comparator[i] != approx(v[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
std::string describe() const override {
|
||||||
|
return "is approx: " + ::Catch::Detail::stringify( m_comparator );
|
||||||
|
}
|
||||||
|
template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
|
ApproxMatcher& epsilon( T const& newEpsilon ) {
|
||||||
|
approx.epsilon(newEpsilon);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
|
ApproxMatcher& margin( T const& newMargin ) {
|
||||||
|
approx.margin(newMargin);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
|
ApproxMatcher& scale( T const& newScale ) {
|
||||||
|
approx.scale(newScale);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<T> const& m_comparator;
|
||||||
|
mutable Catch::Detail::Approx approx = Catch::Detail::Approx::custom();
|
||||||
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct UnorderedEqualsMatcher : MatcherBase<std::vector<T>> {
|
struct UnorderedEqualsMatcher : MatcherBase<std::vector<T>> {
|
||||||
UnorderedEqualsMatcher(std::vector<T> const& target) : m_target(target) {}
|
UnorderedEqualsMatcher(std::vector<T> const& target) : m_target(target) {}
|
||||||
@ -3306,28 +3320,7 @@ namespace Matchers {
|
|||||||
if (m_target.size() != vec.size()) {
|
if (m_target.size() != vec.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto lfirst = m_target.begin(), llast = m_target.end();
|
return std::is_permutation(m_target.begin(), m_target.end(), vec.begin());
|
||||||
auto rfirst = vec.begin(), rlast = vec.end();
|
|
||||||
// Cut common prefix to optimize checking of permuted parts
|
|
||||||
while (lfirst != llast && *lfirst == *rfirst) {
|
|
||||||
++lfirst; ++rfirst;
|
|
||||||
}
|
|
||||||
if (lfirst == llast) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto mid = lfirst; mid != llast; ++mid) {
|
|
||||||
// Skip already counted items
|
|
||||||
if (Detail::contains(lfirst, mid, *mid)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
size_t num_vec = Detail::count(rfirst, rlast, *mid);
|
|
||||||
if (num_vec == 0 || Detail::count(lfirst, llast, *mid) != num_vec) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string describe() const override {
|
std::string describe() const override {
|
||||||
@ -3357,6 +3350,11 @@ namespace Matchers {
|
|||||||
return Vector::EqualsMatcher<T>( comparator );
|
return Vector::EqualsMatcher<T>( comparator );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
Vector::ApproxMatcher<T> Approx( std::vector<T> const& comparator ) {
|
||||||
|
return Vector::ApproxMatcher<T>( comparator );
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Vector::UnorderedEqualsMatcher<T> UnorderedEquals(std::vector<T> const& target) {
|
Vector::UnorderedEqualsMatcher<T> UnorderedEquals(std::vector<T> const& target) {
|
||||||
return Vector::UnorderedEqualsMatcher<T>(target);
|
return Vector::UnorderedEqualsMatcher<T>(target);
|
||||||
@ -4535,7 +4533,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
NamePattern( std::string const& name );
|
NamePattern( std::string const& name );
|
||||||
virtual ~NamePattern();
|
virtual ~NamePattern();
|
||||||
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
bool matches( TestCaseInfo const& testCase ) const override;
|
||||||
private:
|
private:
|
||||||
WildcardPattern m_wildcardPattern;
|
WildcardPattern m_wildcardPattern;
|
||||||
};
|
};
|
||||||
@ -4544,7 +4542,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
TagPattern( std::string const& tag );
|
TagPattern( std::string const& tag );
|
||||||
virtual ~TagPattern();
|
virtual ~TagPattern();
|
||||||
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
bool matches( TestCaseInfo const& testCase ) const override;
|
||||||
private:
|
private:
|
||||||
std::string m_tag;
|
std::string m_tag;
|
||||||
};
|
};
|
||||||
@ -4553,7 +4551,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
ExcludedPattern( PatternPtr const& underlyingPattern );
|
ExcludedPattern( PatternPtr const& underlyingPattern );
|
||||||
virtual ~ExcludedPattern();
|
virtual ~ExcludedPattern();
|
||||||
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
bool matches( TestCaseInfo const& testCase ) const override;
|
||||||
private:
|
private:
|
||||||
PatternPtr m_underlyingPattern;
|
PatternPtr m_underlyingPattern;
|
||||||
};
|
};
|
||||||
@ -4728,7 +4726,7 @@ namespace Catch {
|
|||||||
std::vector<std::string> const& getTestsOrTags() const override;
|
std::vector<std::string> const& getTestsOrTags() const override;
|
||||||
std::vector<std::string> const& getSectionsToRun() const override;
|
std::vector<std::string> const& getSectionsToRun() const override;
|
||||||
|
|
||||||
virtual TestSpec const& testSpec() const override;
|
TestSpec const& testSpec() const override;
|
||||||
bool hasTestFilters() const override;
|
bool hasTestFilters() const override;
|
||||||
|
|
||||||
bool showHelp() const;
|
bool showHelp() const;
|
||||||
@ -5419,11 +5417,11 @@ namespace Catch {
|
|||||||
|
|
||||||
class ReporterFactory : public IReporterFactory {
|
class ReporterFactory : public IReporterFactory {
|
||||||
|
|
||||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
||||||
return std::unique_ptr<T>( new T( config ) );
|
return std::unique_ptr<T>( new T( config ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string getDescription() const override {
|
std::string getDescription() const override {
|
||||||
return T::getDescription();
|
return T::getDescription();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -5440,10 +5438,10 @@ namespace Catch {
|
|||||||
|
|
||||||
class ListenerFactory : public IReporterFactory {
|
class ListenerFactory : public IReporterFactory {
|
||||||
|
|
||||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
||||||
return std::unique_ptr<T>( new T( config ) );
|
return std::unique_ptr<T>( new T( config ) );
|
||||||
}
|
}
|
||||||
virtual std::string getDescription() const override {
|
std::string getDescription() const override {
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -5844,8 +5842,6 @@ namespace TestCaseTracking {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static TrackerContext& instance();
|
|
||||||
|
|
||||||
ITracker& startRun();
|
ITracker& startRun();
|
||||||
void endRun();
|
void endRun();
|
||||||
|
|
||||||
@ -5991,18 +5987,18 @@ namespace Detail {
|
|||||||
return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));
|
return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Approx::setMargin(double margin) {
|
void Approx::setMargin(double newMargin) {
|
||||||
CATCH_ENFORCE(margin >= 0,
|
CATCH_ENFORCE(newMargin >= 0,
|
||||||
"Invalid Approx::margin: " << margin << '.'
|
"Invalid Approx::margin: " << newMargin << '.'
|
||||||
<< " Approx::Margin has to be non-negative.");
|
<< " Approx::Margin has to be non-negative.");
|
||||||
m_margin = margin;
|
m_margin = newMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Approx::setEpsilon(double epsilon) {
|
void Approx::setEpsilon(double newEpsilon) {
|
||||||
CATCH_ENFORCE(epsilon >= 0 && epsilon <= 1.0,
|
CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0,
|
||||||
"Invalid Approx::epsilon: " << epsilon << '.'
|
"Invalid Approx::epsilon: " << newEpsilon << '.'
|
||||||
<< " Approx::epsilon has to be in [0, 1]");
|
<< " Approx::epsilon has to be in [0, 1]");
|
||||||
m_epsilon = epsilon;
|
m_epsilon = newEpsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace Detail
|
} // end namespace Detail
|
||||||
@ -6638,6 +6634,9 @@ public:
|
|||||||
m_suffix = false;
|
m_suffix = false;
|
||||||
auto width = m_column.m_width - indent();
|
auto width = m_column.m_width - indent();
|
||||||
m_end = m_pos;
|
m_end = m_pos;
|
||||||
|
if (line()[m_pos] == '\n') {
|
||||||
|
++m_end;
|
||||||
|
}
|
||||||
while (m_end < line().size() && line()[m_end] != '\n')
|
while (m_end < line().size() && line()[m_end] != '\n')
|
||||||
++m_end;
|
++m_end;
|
||||||
|
|
||||||
@ -8042,10 +8041,7 @@ namespace Catch {
|
|||||||
m_stream( openStream() )
|
m_stream( openStream() )
|
||||||
{
|
{
|
||||||
TestSpecParser parser(ITagAliasRegistry::get());
|
TestSpecParser parser(ITagAliasRegistry::get());
|
||||||
if (data.testsOrTags.empty()) {
|
if (!data.testsOrTags.empty()) {
|
||||||
parser.parse("~[.]"); // All not hidden tests
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_hasTestFilters = true;
|
m_hasTestFilters = true;
|
||||||
for( auto const& testOrTags : data.testsOrTags )
|
for( auto const& testOrTags : data.testsOrTags )
|
||||||
parser.parse( testOrTags );
|
parser.parse( testOrTags );
|
||||||
@ -8163,7 +8159,7 @@ namespace {
|
|||||||
originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
|
originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void use( Colour::Code _colourCode ) override {
|
void use( Colour::Code _colourCode ) override {
|
||||||
switch( _colourCode ) {
|
switch( _colourCode ) {
|
||||||
case Colour::None: return setTextAttribute( originalForegroundAttributes );
|
case Colour::None: return setTextAttribute( originalForegroundAttributes );
|
||||||
case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
|
case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
|
||||||
@ -8226,7 +8222,7 @@ namespace {
|
|||||||
// https://github.com/philsquared/Catch/pull/131
|
// https://github.com/philsquared/Catch/pull/131
|
||||||
class PosixColourImpl : public IColourImpl {
|
class PosixColourImpl : public IColourImpl {
|
||||||
public:
|
public:
|
||||||
virtual void use( Colour::Code _colourCode ) override {
|
void use( Colour::Code _colourCode ) override {
|
||||||
switch( _colourCode ) {
|
switch( _colourCode ) {
|
||||||
case Colour::None:
|
case Colour::None:
|
||||||
case Colour::White: return setColour( "[0m" );
|
case Colour::White: return setColour( "[0m" );
|
||||||
@ -8337,27 +8333,27 @@ namespace Catch {
|
|||||||
class Context : public IMutableContext, NonCopyable {
|
class Context : public IMutableContext, NonCopyable {
|
||||||
|
|
||||||
public: // IContext
|
public: // IContext
|
||||||
virtual IResultCapture* getResultCapture() override {
|
IResultCapture* getResultCapture() override {
|
||||||
return m_resultCapture;
|
return m_resultCapture;
|
||||||
}
|
}
|
||||||
virtual IRunner* getRunner() override {
|
IRunner* getRunner() override {
|
||||||
return m_runner;
|
return m_runner;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual IConfigPtr const& getConfig() const override {
|
IConfigPtr const& getConfig() const override {
|
||||||
return m_config;
|
return m_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Context() override;
|
~Context() override;
|
||||||
|
|
||||||
public: // IMutableContext
|
public: // IMutableContext
|
||||||
virtual void setResultCapture( IResultCapture* resultCapture ) override {
|
void setResultCapture( IResultCapture* resultCapture ) override {
|
||||||
m_resultCapture = resultCapture;
|
m_resultCapture = resultCapture;
|
||||||
}
|
}
|
||||||
virtual void setRunner( IRunner* runner ) override {
|
void setRunner( IRunner* runner ) override {
|
||||||
m_runner = runner;
|
m_runner = runner;
|
||||||
}
|
}
|
||||||
virtual void setConfig( IConfigPtr const& config ) override {
|
void setConfig( IConfigPtr const& config ) override {
|
||||||
m_config = config;
|
m_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8423,19 +8419,23 @@ namespace Catch {
|
|||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/sysctl.h>
|
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
# include <ostream>
|
# include <ostream>
|
||||||
|
|
||||||
namespace Catch {
|
#ifdef __apple_build_version__
|
||||||
|
// These headers will only compile with AppleClang (XCode)
|
||||||
|
// For other compilers (Clang, GCC, ... ) we need to exclude them
|
||||||
|
# include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
#ifdef __apple_build_version__
|
||||||
// The following function is taken directly from the following technical note:
|
// The following function is taken directly from the following technical note:
|
||||||
// http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html
|
// https://developer.apple.com/library/archive/qa/qa1361/_index.html
|
||||||
|
|
||||||
// Returns true if the current process is being debugged (either
|
// Returns true if the current process is being debugged (either
|
||||||
// running under the debugger or has a debugger attached post facto).
|
// running under the debugger or has a debugger attached post facto).
|
||||||
bool isDebuggerActive(){
|
bool isDebuggerActive(){
|
||||||
|
|
||||||
int mib[4];
|
int mib[4];
|
||||||
struct kinfo_proc info;
|
struct kinfo_proc info;
|
||||||
std::size_t size;
|
std::size_t size;
|
||||||
@ -8465,6 +8465,12 @@ namespace Catch {
|
|||||||
|
|
||||||
return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
|
return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool isDebuggerActive() {
|
||||||
|
// We need to find another way to determine this for non-appleclang compilers on macOS
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
#elif defined(CATCH_PLATFORM_LINUX)
|
#elif defined(CATCH_PLATFORM_LINUX)
|
||||||
@ -8569,7 +8575,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
~ExceptionTranslatorRegistry();
|
~ExceptionTranslatorRegistry();
|
||||||
virtual void registerTranslator( const IExceptionTranslator* translator );
|
virtual void registerTranslator( const IExceptionTranslator* translator );
|
||||||
virtual std::string translateActiveException() const override;
|
std::string translateActiveException() const override;
|
||||||
std::string tryTranslators() const;
|
std::string tryTranslators() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -9842,7 +9848,7 @@ namespace Catch {
|
|||||||
if (strerror_s(buffer, errno)) {
|
if (strerror_s(buffer, errno)) {
|
||||||
CATCH_RUNTIME_ERROR("Could not translate errno to a string");
|
CATCH_RUNTIME_ERROR("Could not translate errno to a string");
|
||||||
}
|
}
|
||||||
CATCH_RUNTIME_ERROR("Coul dnot open the temp file: '" << m_buffer << "' because: " << buffer);
|
CATCH_RUNTIME_ERROR("Could not open the temp file: '" << m_buffer << "' because: " << buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -10920,7 +10926,10 @@ namespace Catch {
|
|||||||
|
|
||||||
auto const& allTestCases = getAllTestCasesSorted(*config);
|
auto const& allTestCases = getAllTestCasesSorted(*config);
|
||||||
for (auto const& testCase : allTestCases) {
|
for (auto const& testCase : allTestCases) {
|
||||||
if (!context.aborting() && matchTest(testCase, testSpec, *config))
|
bool matching = (!testSpec.hasFilters() && !testCase.isHidden()) ||
|
||||||
|
(testSpec.hasFilters() && matchTest(testCase, testSpec, *config));
|
||||||
|
|
||||||
|
if (!context.aborting() && matching)
|
||||||
totals += context.runTest(testCase);
|
totals += context.runTest(testCase);
|
||||||
else
|
else
|
||||||
context.reporter().skipTest(testCase);
|
context.reporter().skipTest(testCase);
|
||||||
@ -11646,7 +11655,7 @@ namespace Catch {
|
|||||||
void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
||||||
CATCH_ENFORCE( !isReservedTag(tag),
|
CATCH_ENFORCE( !isReservedTag(tag),
|
||||||
"Tag name: [" << tag << "] is not allowed.\n"
|
"Tag name: [" << tag << "] is not allowed.\n"
|
||||||
<< "Tag names starting with non alpha-numeric characters are reserved\n"
|
<< "Tag names starting with non alphanumeric characters are reserved\n"
|
||||||
<< _lineInfo );
|
<< _lineInfo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11828,9 +11837,12 @@ namespace Catch {
|
|||||||
std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
|
std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
|
||||||
std::vector<TestCase> filtered;
|
std::vector<TestCase> filtered;
|
||||||
filtered.reserve( testCases.size() );
|
filtered.reserve( testCases.size() );
|
||||||
for( auto const& testCase : testCases )
|
for (auto const& testCase : testCases) {
|
||||||
if( matchTest( testCase, testSpec, config ) )
|
if ((!testSpec.hasFilters() && !testCase.isHidden()) ||
|
||||||
filtered.push_back( testCase );
|
(testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {
|
||||||
|
filtered.push_back(testCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
|
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
|
||||||
@ -11906,11 +11918,6 @@ namespace TestCaseTracking {
|
|||||||
|
|
||||||
ITracker::~ITracker() = default;
|
ITracker::~ITracker() = default;
|
||||||
|
|
||||||
TrackerContext& TrackerContext::instance() {
|
|
||||||
static TrackerContext s_instance;
|
|
||||||
return s_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
ITracker& TrackerContext::startRun() {
|
ITracker& TrackerContext::startRun() {
|
||||||
m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr );
|
m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr );
|
||||||
m_currentTracker = nullptr;
|
m_currentTracker = nullptr;
|
||||||
@ -12692,7 +12699,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 7, 1, "", 0 );
|
static Version version( 2, 7, 2, "", 0 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14051,22 +14058,6 @@ namespace Catch {
|
|||||||
void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) {
|
void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) {
|
||||||
CumulativeReporterBase::testRunStarting( runInfo );
|
CumulativeReporterBase::testRunStarting( runInfo );
|
||||||
xml.startElement( "testsuites" );
|
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.scopedElement( "property" )
|
|
||||||
.writeAttribute( "name", "random-seed" )
|
|
||||||
.writeAttribute( "value", m_config->rngSeed() );
|
|
||||||
xml.endElement();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) {
|
void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) {
|
||||||
@ -14105,6 +14096,7 @@ namespace Catch {
|
|||||||
|
|
||||||
void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) {
|
void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) {
|
||||||
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
||||||
|
|
||||||
TestGroupStats const& stats = groupNode.value;
|
TestGroupStats const& stats = groupNode.value;
|
||||||
xml.writeAttribute( "name", stats.groupInfo.name );
|
xml.writeAttribute( "name", stats.groupInfo.name );
|
||||||
xml.writeAttribute( "errors", unexpectedExceptions );
|
xml.writeAttribute( "errors", unexpectedExceptions );
|
||||||
@ -14117,6 +14109,21 @@ namespace Catch {
|
|||||||
xml.writeAttribute( "time", suiteTime );
|
xml.writeAttribute( "time", suiteTime );
|
||||||
xml.writeAttribute( "timestamp", getCurrentTimestamp() );
|
xml.writeAttribute( "timestamp", getCurrentTimestamp() );
|
||||||
|
|
||||||
|
// Write properties if there are any
|
||||||
|
if (m_config->hasTestFilters() || m_config->rngSeed() != 0) {
|
||||||
|
auto properties = xml.scopedElement("properties");
|
||||||
|
if (m_config->hasTestFilters()) {
|
||||||
|
xml.scopedElement("property")
|
||||||
|
.writeAttribute("name", "filters")
|
||||||
|
.writeAttribute("value", serializeFilters(m_config->getTestsOrTags()));
|
||||||
|
}
|
||||||
|
if (m_config->rngSeed() != 0) {
|
||||||
|
xml.scopedElement("property")
|
||||||
|
.writeAttribute("name", "random-seed")
|
||||||
|
.writeAttribute("value", m_config->rngSeed());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Write test cases
|
// Write test cases
|
||||||
for( auto const& child : groupNode.children )
|
for( auto const& child : groupNode.children )
|
||||||
writeTestCase( *child );
|
writeTestCase( *child );
|
||||||
|
Loading…
Reference in New Issue
Block a user