Skip to content

Commit

Permalink
v2.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Jul 12, 2020
1 parent 4c85248 commit 7f21cc6
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 39 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -14,7 +14,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
endif()


project(Catch2 LANGUAGES CXX VERSION 2.12.4)
project(Catch2 LANGUAGES CXX VERSION 2.13.0)

# Provide path for scripts
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -5,11 +5,11 @@
[![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)
[![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/wRuqI3INY7fTagL7)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/aavJBzemrxUgGV9S)
[![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.12.4/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.13.0/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>

## Catch2 is released!

Expand Down
2 changes: 1 addition & 1 deletion docs/command-line.md
Expand Up @@ -224,7 +224,7 @@ When set to ```yes``` Catch will report the duration of each test case, in milli

<pre>-D, --min-duration &lt;value></pre>

> `--min-duration` was [introduced](https://github.com/catchorg/Catch2/pull/1910) in Catch X.Y.Z
> `--min-duration` was [introduced](https://github.com/catchorg/Catch2/pull/1910) in Catch 2.13.0
When set, Catch will report the duration of each test case that took more
than &lt;value> seconds, in milliseconds. This option is overriden by both
Expand Down
2 changes: 1 addition & 1 deletion docs/generators.md
Expand Up @@ -92,7 +92,7 @@ TEST_CASE("Complex mix of sections and generates") {
}
```

> The ability to place `GENERATE` between two `SECTION`s was [introduced](https://github.com/catchorg/Catch2/issues/1938) in Catch X.Y.Z.
> The ability to place `GENERATE` between two `SECTION`s was [introduced](https://github.com/catchorg/Catch2/issues/1938) in Catch 2.13.0.
## Provided generators

Expand Down
13 changes: 13 additions & 0 deletions docs/release-notes.md
Expand Up @@ -2,6 +2,7 @@

# Release notes
**Contents**<br>
[2.13.0](#2130)<br>
[2.12.4](#2124)<br>
[2.12.3](#2123)<br>
[2.12.2](#2122)<br>
Expand Down Expand Up @@ -39,6 +40,18 @@
[Older versions](#older-versions)<br>
[Even Older versions](#even-older-versions)<br>

## 2.13.0

### Improvements
* `GENERATE` can now follow a `SECTION` at the same level of nesting (#1938)
* The `SECTION`(s) before the `GENERATE` will not be run multiple times, the following ones will.
* Added `-D`/`--min-duration` command line flag (#1910)
* If a test takes longer to finish than the provided value, its name and duration will be printed.
* This flag is overriden by setting `-d`/`--duration`.

### Fixes
* `TAPReporter` no longer skips successful assertions (#1983)


## 2.12.4

Expand Down
4 changes: 2 additions & 2 deletions include/catch.hpp
Expand Up @@ -10,8 +10,8 @@
#define TWOBLUECUBES_CATCH_HPP_INCLUDED

#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 12
#define CATCH_VERSION_PATCH 4
#define CATCH_VERSION_MINOR 13
#define CATCH_VERSION_PATCH 0

#ifdef __clang__
# pragma clang system_header
Expand Down
2 changes: 1 addition & 1 deletion include/internal/catch_version.cpp
Expand Up @@ -37,7 +37,7 @@ namespace Catch {
}

Version const& libraryVersion() {
static Version version( 2, 12, 4, "", 0 );
static Version version( 2, 13, 0, "", 0 );
return version;
}

Expand Down
81 changes: 61 additions & 20 deletions single_include/catch2/catch.hpp
@@ -1,6 +1,6 @@
/*
* Catch v2.12.4
* Generated: 2020-07-05 11:47:18.451282
* Catch v2.13.0
* Generated: 2020-07-12 20:07:49.015950
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
Expand All @@ -14,8 +14,8 @@


#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 12
#define CATCH_VERSION_PATCH 4
#define CATCH_VERSION_MINOR 13
#define CATCH_VERSION_PATCH 0

#ifdef __clang__
# pragma clang system_header
Expand Down Expand Up @@ -4522,6 +4522,7 @@ namespace Catch {
virtual int abortAfter() const = 0;
virtual bool showInvisibles() const = 0;
virtual ShowDurations::OrNot showDurations() const = 0;
virtual double minDuration() const = 0;
virtual TestSpec const& testSpec() const = 0;
virtual bool hasTestFilters() const = 0;
virtual std::vector<std::string> const& getTestsOrTags() const = 0;
Expand Down Expand Up @@ -5294,6 +5295,7 @@ namespace Catch {
Verbosity verbosity = Verbosity::Normal;
WarnAbout::What warnings = WarnAbout::Nothing;
ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
double minDuration = -1;
RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
UseColour::YesOrNo useColour = UseColour::Auto;
WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
Expand Down Expand Up @@ -5344,6 +5346,7 @@ namespace Catch {
bool warnAboutMissingAssertions() const override;
bool warnAboutNoTests() const override;
ShowDurations::OrNot showDurations() const override;
double minDuration() const override;
RunTests::InWhatOrder runOrder() const override;
unsigned int rngSeed() const override;
UseColour::YesOrNo useColour() const override;
Expand Down Expand Up @@ -5721,6 +5724,9 @@ namespace Catch {
// Returns double formatted as %.3f (format expected on output)
std::string getFormattedDuration( double duration );

//! Should the reporter show
bool shouldShowDuration( IConfig const& config, double duration );

std::string serializeFilters( std::vector<std::string> const& container );

template<typename DerivedT>
Expand Down Expand Up @@ -6114,8 +6120,6 @@ namespace Catch {

static std::string getDescription();

ReporterPreferences getPreferences() const override;

void noMatchingTestCases(std::string const& spec) override;

void assertionStarting(AssertionInfo const&) override;
Expand Down Expand Up @@ -7499,6 +7503,7 @@ namespace TestCaseTracking {
virtual bool isSuccessfullyCompleted() const = 0;
virtual bool isOpen() const = 0; // Started but not complete
virtual bool hasChildren() const = 0;
virtual bool hasStarted() const = 0;

virtual ITracker& parent() = 0;

Expand Down Expand Up @@ -7565,6 +7570,9 @@ namespace TestCaseTracking {
bool isSuccessfullyCompleted() const override;
bool isOpen() const override;
bool hasChildren() const override;
bool hasStarted() const override {
return m_runState != NotStarted;
}

void addChild( ITrackerPtr const& child ) override;

Expand Down Expand Up @@ -9861,6 +9869,9 @@ namespace Catch {
| Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
["-d"]["--durations"]
( "show test durations" )
| Opt( config.minDuration, "seconds" )
["-D"]["--min-duration"]
( "show test durations for tests taking at least the given number of seconds" )
| Opt( loadTestNamesFromFile, "filename" )
["-f"]["--input-file"]
( "load test names to run from a file" )
Expand Down Expand Up @@ -10008,6 +10019,7 @@ namespace Catch {
bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); }
bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); }
ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }
double Config::minDuration() const { return m_data.minDuration; }
RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; }
unsigned int Config::rngSeed() const { return m_data.rngSeed; }
UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }
Expand Down Expand Up @@ -12547,7 +12559,7 @@ namespace Catch {
currentTracker.addChild( tracker );
}

if( !ctx.completedCycle() && !tracker->isComplete() ) {
if( !tracker->isComplete() ) {
tracker->open();
}

Expand All @@ -12561,8 +12573,28 @@ namespace Catch {
}
void close() override {
TrackerBase::close();
// Generator interface only finds out if it has another item on atual move
if (m_runState == CompletedSuccessfully && m_generator->next()) {
// If a generator has a child (it is followed by a section)
// and none of its children have started, then we must wait
// until later to start consuming its values.
// This catches cases where `GENERATE` is placed between two
// `SECTION`s.
// **The check for m_children.empty cannot be removed**.
// doing so would break `GENERATE` _not_ followed by `SECTION`s.
const bool should_wait_for_child =
!m_children.empty() &&
std::find_if( m_children.begin(),
m_children.end(),
[]( TestCaseTracking::ITrackerPtr tracker ) {
return tracker->hasStarted();
} ) == m_children.end();

// This check is a bit tricky, because m_generator->next()
// has a side-effect, where it consumes generator's current
// value, but we do not want to invoke the side-effect if
// this generator is still waiting for any child to start.
if ( should_wait_for_child ||
( m_runState == CompletedSuccessfully &&
m_generator->next() ) ) {
m_children.clear();
m_runState = Executing;
}
Expand Down Expand Up @@ -12702,7 +12734,6 @@ namespace Catch {
using namespace Generators;
GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext,
TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) );
assert( tracker.isOpen() );
m_lastAssertionInfo.lineInfo = lineInfo;
return tracker;
}
Expand Down Expand Up @@ -14381,7 +14412,8 @@ namespace TestCaseTracking {
bool SectionTracker::isComplete() const {
bool complete = true;

if ((m_filters.empty() || m_filters[0] == "")
if (m_filters.empty()
|| m_filters[0] == ""
|| std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) {
complete = TrackerBase::isComplete();
}
Expand Down Expand Up @@ -15206,7 +15238,7 @@ namespace Catch {
}

Version const& libraryVersion() {
static Version version( 2, 12, 4, "", 0 );
static Version version( 2, 13, 0, "", 0 );
return version;
}

Expand Down Expand Up @@ -15608,6 +15640,17 @@ namespace Catch {
return std::string(buffer);
}

bool shouldShowDuration( IConfig const& config, double duration ) {
if ( config.showDurations() == ShowDurations::Always ) {
return true;
}
if ( config.showDurations() == ShowDurations::Never ) {
return false;
}
const double min = config.minDuration();
return min >= 0 && duration >= min;
}

std::string serializeFilters( std::vector<std::string> const& container ) {
ReusableStringStream oss;
bool first = true;
Expand Down Expand Up @@ -15874,10 +15917,6 @@ class AssertionPrinter {
return "Reports test results on a single line, suitable for IDEs";
}

ReporterPreferences CompactReporter::getPreferences() const {
return m_reporterPrefs;
}

void CompactReporter::noMatchingTestCases( std::string const& spec ) {
stream << "No test cases matched '" << spec << '\'' << std::endl;
}
Expand All @@ -15904,8 +15943,9 @@ class AssertionPrinter {
}

void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {
if (m_config->showDurations() == ShowDurations::Always) {
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
double dur = _sectionStats.durationInSeconds;
if ( shouldShowDuration( *m_config, dur ) ) {
stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << std::endl;
}
}

Expand Down Expand Up @@ -16325,8 +16365,9 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
stream << "\nNo assertions in test case";
stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
}
if (m_config->showDurations() == ShowDurations::Always) {
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
double dur = _sectionStats.durationInSeconds;
if (shouldShowDuration(*m_config, dur)) {
stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << std::endl;
}
if (m_headerPrinted) {
m_headerPrinted = false;
Expand Down
23 changes: 12 additions & 11 deletions single_include/catch2/catch_reporter_tap.hpp
Expand Up @@ -23,16 +23,17 @@ namespace Catch {

using StreamingReporterBase::StreamingReporterBase;

TAPReporter( ReporterConfig const& config ):
StreamingReporterBase( config ) {
m_reporterPrefs.shouldReportAllAssertions = true;
}

~TAPReporter() override;

static std::string getDescription() {
return "Reports test results in TAP format, suitable for test harnesses";
}

ReporterPreferences getPreferences() const override {
return m_reporterPrefs;
}

void noMatchingTestCases( std::string const& spec ) override {
stream << "# No test cases matched '" << spec << "'" << std::endl;
}
Expand Down Expand Up @@ -203,24 +204,25 @@ namespace Catch {
return;
}

// using messages.end() directly (or auto) yields compilation error:
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
const auto itEnd = messages.cend();
const auto N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );

{
Colour colourGuard( colour );
stream << " with " << pluralise( N, "message" ) << ":";
}

for(; itMessage != itEnd; ) {
while( itMessage != itEnd ) {
// If this assertion is a warning ignore any INFO messages
if( printInfoMessages || itMessage->type != ResultWas::Info ) {
stream << " '" << itMessage->message << "'";
if ( ++itMessage != itEnd ) {
Colour colourGuard( dimColour() );
stream << " and";
}
continue;
}
++itMessage;
}
}

Expand All @@ -234,10 +236,9 @@ namespace Catch {
};

void printTotals( const Totals& totals ) const {
stream << "1.." << totals.assertions.total();
if( totals.testCases.total() == 0 ) {
stream << "1..0 # Skipped: No tests ran.";
} else {
stream << "1.." << counter;
stream << " # Skipped: No tests ran.";
}
}
};
Expand Down

0 comments on commit 7f21cc6

Please sign in to comment.