mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-14 01:15:39 +02:00
Compare commits
35 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d2a130f243 | ||
![]() |
7be8a41adf | ||
![]() |
021fcee636 | ||
![]() |
3a47b8b072 | ||
![]() |
2771a8ee9a | ||
![]() |
7abd7db2c8 | ||
![]() |
88d7b8da25 | ||
![]() |
df0b0e64e1 | ||
![]() |
4c7b7d04fe | ||
![]() |
90988f578c | ||
![]() |
e5fe3e877a | ||
![]() |
6c5c4c43a0 | ||
![]() |
c323658483 | ||
![]() |
db570b7e24 | ||
![]() |
0074926e5c | ||
![]() |
6496c51c95 | ||
![]() |
3dd523bdf5 | ||
![]() |
8d5d49299b | ||
![]() |
d0287e3b56 | ||
![]() |
dd99a66cf4 | ||
![]() |
ae590fe216 | ||
![]() |
7f791fa08f | ||
![]() |
0510d4755f | ||
![]() |
e92b9c07c3 | ||
![]() |
88a6ff0b65 | ||
![]() |
9e7c281e6e | ||
![]() |
64be2ad96c | ||
![]() |
c651f239f0 | ||
![]() |
43769a19f7 | ||
![]() |
200d3ad824 | ||
![]() |
aa7b0c9104 | ||
![]() |
375f2052bd | ||
![]() |
dc6b83bec9 | ||
![]() |
f00257e374 | ||
![]() |
414dcae34a |
30
.travis.yml
30
.travis.yml
@@ -11,6 +11,7 @@ common_sources: &all_sources
|
||||
- llvm-toolchain-trusty-3.9
|
||||
- llvm-toolchain-trusty-4.0
|
||||
- llvm-toolchain-trusty-5.0
|
||||
- llvm-toolchain-trusty-6.0
|
||||
|
||||
matrix:
|
||||
include:
|
||||
@@ -67,6 +68,14 @@ matrix:
|
||||
packages: ['clang-5.0']
|
||||
env: COMPILER='clang++-5.0'
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons:
|
||||
apt:
|
||||
sources: *all_sources
|
||||
packages: ['clang-6.0']
|
||||
env: COMPILER='clang++-6.0'
|
||||
|
||||
# 2/ Linux GCC Builds
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
@@ -108,6 +117,14 @@ matrix:
|
||||
packages: ['g++-7']
|
||||
env: COMPILER='g++-7'
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons: &gcc8
|
||||
apt:
|
||||
sources: *all_sources
|
||||
packages: ['g++-8']
|
||||
env: COMPILER='g++-8'
|
||||
|
||||
# 3b/ Linux C++14 Clang builds
|
||||
# Note that we need newer libstdc++ for C++14 support
|
||||
- os: linux
|
||||
@@ -144,6 +161,14 @@ matrix:
|
||||
packages: ['clang-5.0', 'libstdc++-6-dev']
|
||||
env: COMPILER='clang++-5.0' CPP14=1
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons:
|
||||
apt:
|
||||
sources: *all_sources
|
||||
packages: ['clang-6.0', 'libstdc++-6-dev']
|
||||
env: COMPILER='clang++-6.0' CPP14=1
|
||||
|
||||
|
||||
# 4a/ Linux C++14 GCC builds
|
||||
- os: linux
|
||||
@@ -156,6 +181,11 @@ matrix:
|
||||
addons: *gcc7
|
||||
env: COMPILER='g++-7' CPP14=1
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons: *gcc8
|
||||
env: COMPILER='g++-8' CPP14=1
|
||||
|
||||
# 5/ OSX Clang Builds
|
||||
- os: osx
|
||||
osx_image: xcode7.3
|
||||
|
@@ -6,7 +6,7 @@ if(NOT DEFINED PROJECT_NAME)
|
||||
set(NOT_SUBPROJECT ON)
|
||||
endif()
|
||||
|
||||
project(Catch2 LANGUAGES CXX VERSION 2.2.2)
|
||||
project(Catch2 LANGUAGES CXX VERSION 2.2.3)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@@ -159,6 +159,7 @@ set(INTERNAL_HEADERS
|
||||
${HEADER_DIR}/internal/catch_objc.hpp
|
||||
${HEADER_DIR}/internal/catch_objc_arc.hpp
|
||||
${HEADER_DIR}/internal/catch_option.hpp
|
||||
${HEADER_DIR}/internal/catch_output_redirect.h
|
||||
${HEADER_DIR}/internal/catch_platform.h
|
||||
${HEADER_DIR}/internal/catch_random_number_generator.h
|
||||
${HEADER_DIR}/internal/catch_reenable_warnings.h
|
||||
@@ -186,6 +187,7 @@ set(INTERNAL_HEADERS
|
||||
${HEADER_DIR}/internal/catch_test_spec_parser.h
|
||||
${HEADER_DIR}/internal/catch_text.h
|
||||
${HEADER_DIR}/internal/catch_timer.h
|
||||
${HEADER_DIR}/internal/catch_to_string.hpp
|
||||
${HEADER_DIR}/internal/catch_tostring.h
|
||||
${HEADER_DIR}/internal/catch_totals.h
|
||||
${HEADER_DIR}/internal/catch_uncaught_exceptions.h
|
||||
@@ -225,6 +227,7 @@ set(IMPL_SOURCES
|
||||
${HEADER_DIR}/internal/catch_matchers_generic.cpp
|
||||
${HEADER_DIR}/internal/catch_matchers_string.cpp
|
||||
${HEADER_DIR}/internal/catch_message.cpp
|
||||
${HEADER_DIR}/internal/catch_output_redirect.cpp
|
||||
${HEADER_DIR}/internal/catch_registry_hub.cpp
|
||||
${HEADER_DIR}/internal/catch_interfaces_reporter.cpp
|
||||
${HEADER_DIR}/internal/catch_random_number_generator.cpp
|
||||
@@ -265,7 +268,7 @@ set(REPORTER_HEADERS
|
||||
${HEADER_DIR}/reporters/catch_reporter_compact.h
|
||||
${HEADER_DIR}/reporters/catch_reporter_console.h
|
||||
${HEADER_DIR}/reporters/catch_reporter_junit.h
|
||||
${HEADER_DIR}/reporters/catch_reporter_multi.h
|
||||
${HEADER_DIR}/reporters/catch_reporter_listening.h
|
||||
${HEADER_DIR}/reporters/catch_reporter_tap.hpp
|
||||
${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp
|
||||
${HEADER_DIR}/reporters/catch_reporter_xml.h
|
||||
@@ -275,7 +278,7 @@ set(REPORTER_SOURCES
|
||||
${HEADER_DIR}/reporters/catch_reporter_compact.cpp
|
||||
${HEADER_DIR}/reporters/catch_reporter_console.cpp
|
||||
${HEADER_DIR}/reporters/catch_reporter_junit.cpp
|
||||
${HEADER_DIR}/reporters/catch_reporter_multi.cpp
|
||||
${HEADER_DIR}/reporters/catch_reporter_listening.cpp
|
||||
${HEADER_DIR}/reporters/catch_reporter_xml.cpp
|
||||
)
|
||||
set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES})
|
||||
|
@@ -5,9 +5,9 @@
|
||||
[](https://travis-ci.org/catchorg/Catch2)
|
||||
[](https://ci.appveyor.com/project/catchorg/catch2)
|
||||
[](https://codecov.io/gh/catchorg/Catch2)
|
||||
[](https://wandbox.org/permlink/fRDMfYjUnrbOFwLn)
|
||||
[](https://wandbox.org/permlink/u7qF77qgv9YqOr55)
|
||||
|
||||
<a href="https://github.com/catchorg/Catch2/releases/download/v2.2.2/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.2.3/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
||||
|
||||
## Catch2 is released!
|
||||
|
||||
|
14
codecov.yml
14
codecov.yml
@@ -9,6 +9,12 @@ coverage:
|
||||
patch:
|
||||
default:
|
||||
target: 80%
|
||||
ignore:
|
||||
- "projects/SelfTest"
|
||||
- "**/catch_reporter_tap.hpp"
|
||||
- "**/catch_reporter_automake.hpp"
|
||||
- "**/catch_reporter_teamcity.hpp"
|
||||
- "**/external/clara.hpp"
|
||||
|
||||
|
||||
codecov:
|
||||
@@ -16,11 +22,3 @@ codecov:
|
||||
|
||||
comment:
|
||||
layout: "diff"
|
||||
|
||||
coverage:
|
||||
ignore:
|
||||
- "projects/SelfTest"
|
||||
- "**/catch_reporter_tap.hpp"
|
||||
- "**/catch_reporter_automake.hpp"
|
||||
- "**/catch_reporter_teamcity.hpp"
|
||||
- "**/external/clara.hpp"
|
||||
|
@@ -4,7 +4,7 @@ from conans import ConanFile
|
||||
|
||||
class CatchConan(ConanFile):
|
||||
name = "Catch"
|
||||
version = "2.2.2"
|
||||
version = "2.2.3"
|
||||
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
||||
author = "philsquared"
|
||||
generators = "cmake"
|
||||
|
@@ -50,8 +50,7 @@ string(REPLACE "\n" ";" output "${output}")
|
||||
|
||||
# Parse output
|
||||
foreach(line ${output})
|
||||
# Test name; strip spaces to get just the name...
|
||||
string(REGEX REPLACE " +" "" test "${line}")
|
||||
set(test ${line})
|
||||
# ...and add to script
|
||||
add_command(add_test
|
||||
"${prefix}${test}${suffix}"
|
||||
|
16
contrib/gdbinit
Normal file
16
contrib/gdbinit
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This file provides a way to skip stepping into Catch code when debugging with gdb.
|
||||
#
|
||||
# With the gdb "skip" command you can tell gdb to skip files or functions during debugging.
|
||||
# see https://xaizek.github.io/2016-05-26/skipping-standard-library-in-gdb/ for an example
|
||||
#
|
||||
# Basically the following line tells gdb to skip all functions containing the
|
||||
# regexp "Catch", which matches the complete Catch namespace.
|
||||
# If you want to skip just some parts of the Catch code you can modify the
|
||||
# regexp accordingly.
|
||||
#
|
||||
# If you want to permanently skip stepping into Catch code copy the following
|
||||
# line into your ~/.gdbinit file
|
||||
#
|
||||
|
||||
skip -rfu Catch
|
16
contrib/lldbinit
Normal file
16
contrib/lldbinit
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This file provides a way to skip stepping into Catch code when debugging with lldb.
|
||||
#
|
||||
# With the setting "target.process.thread.step-avoid-regexp" you can tell lldb
|
||||
# to skip functions matching the regexp
|
||||
#
|
||||
# Basically the following line tells lldb to skip all functions containing the
|
||||
# regexp "Catch", which matches the complete Catch namespace.
|
||||
# If you want to skip just some parts of the Catch code you can modify the
|
||||
# regexp accordingly.
|
||||
#
|
||||
# If you want to permanently skip stepping into Catch code copy the following
|
||||
# line into your ~/.lldbinit file
|
||||
#
|
||||
|
||||
settings set target.process.thread.step-avoid-regexp Catch
|
@@ -6,6 +6,7 @@
|
||||
[Exceptions](#exceptions)<br>
|
||||
[Matcher expressions](#matcher-expressions)<br>
|
||||
[Thread Safety](#thread-safety)<br>
|
||||
[Expressions with commas](#expressions-with-commas)<br>
|
||||
|
||||
Most test frameworks have a large collection of assertion macros to capture all possible conditional forms (```_EQUALS```, ```_NOTEQUALS```, ```_GREATER_THAN``` etc).
|
||||
|
||||
@@ -155,6 +156,34 @@ Matchers can be composed using `&&`, `||` and `!` operators.
|
||||
Currently assertions in Catch are not thread safe.
|
||||
For more details, along with workarounds, see the section on [the limitations page](limitations.md#thread-safe-assertions).
|
||||
|
||||
## Expressions with commas
|
||||
|
||||
Because the preprocessor parses code using different rules than the
|
||||
compiler, multiple-argument assertions (e.g. `REQUIRE_THROWS_AS`) have
|
||||
problems with commas inside the provided expressions. As an example
|
||||
`REQUIRE_THROWS_AS(std::pair<int, int>(1, 2), std::invalid_argument);`
|
||||
will fail to compile, because the preprocessor sees 3 arguments provided,
|
||||
but the macro accepts only 2. There are two possible workarounds.
|
||||
|
||||
1) Use typedef:
|
||||
```cpp
|
||||
using int_pair = std::pair<int, int>;
|
||||
REQUIRE_THROWS_AS(int_pair(1, 2), std::invalid_argument);
|
||||
```
|
||||
|
||||
This solution is always applicable, but makes the meaning of the code
|
||||
less clear.
|
||||
|
||||
2) Parenthesize the expression:
|
||||
```cpp
|
||||
TEST_CASE_METHOD((Fixture<int, int>), "foo", "[bar]") {
|
||||
SUCCEED();
|
||||
}
|
||||
```
|
||||
|
||||
This solution is not always applicable, because it might require extra
|
||||
changes on the Catch's side to work.
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -24,6 +24,7 @@
|
||||
[Usage](#usage)<br>
|
||||
[Specify the section to run](#specify-the-section-to-run)<br>
|
||||
[Filenames as tags](#filenames-as-tags)<br>
|
||||
[Override output colouring](#use-colour)<br>
|
||||
|
||||
Catch works quite nicely without any command line options at all - but for those times when you want greater control the following options are available.
|
||||
Click one of the followings links to take you straight to that option - or scroll on to browse the available options.
|
||||
@@ -57,6 +58,7 @@ Click one of the followings links to take you straight to that option - or scrol
|
||||
<a href="#libidentify"> ` --libidentify`</a><br />
|
||||
<a href="#wait-for-keypress"> ` --wait-for-keypress`</a><br />
|
||||
<a href="#benchmark-resolution-multiple"> ` --benchmark-resolution-multiple`</a><br />
|
||||
<a href="#use-colour"> ` --use-colour`</a><br />
|
||||
|
||||
</br>
|
||||
|
||||
@@ -329,6 +331,16 @@ filename it is found in, with any extension stripped, prefixed with the `#` char
|
||||
|
||||
So, for example, tests within the file `~\Dev\MyProject\Ferrets.cpp` would be tagged `[#Ferrets]`.
|
||||
|
||||
<a id="use-colour"></a>
|
||||
## Override output colouring
|
||||
<pre>--use-colour <yes|no|auto></pre>
|
||||
|
||||
Catch colours output for terminals, but omits colouring when it detects that
|
||||
output is being sent to a pipe. This is done to avoid interfering with automated
|
||||
processing of output.
|
||||
|
||||
`--use-colour yes` forces coloured output, `--use-colour no` disables coloured
|
||||
output. The default behaviour is `--use-colour auto`.
|
||||
|
||||
---
|
||||
|
||||
|
@@ -77,13 +77,16 @@ This can be useful on certain platforms that do not provide the standard iostrea
|
||||
|
||||
## Fallback stringifier
|
||||
|
||||
By default Catch's stringification machinery falls back to a "{?}". To
|
||||
let projects reuse their own existing stringification machinery, this
|
||||
fallback can be overridden by defining `CATCH_CONFIG_FALLBACK_STRINGIFIER`
|
||||
to a name of a function that should perform the stringification instead.
|
||||
By default, when Catch's stringification machinery has to stringify
|
||||
a type that does not specialize `StringMaker`, does not overload `operator<<`,
|
||||
is not an enumeration and is not a range, it uses `"{?}"`. This can be
|
||||
overriden by defining `CATCH_CONFIG_FALLBACK_STRINGIFIER` to name of a
|
||||
function that should perform the stringification instead.
|
||||
|
||||
The provided function must return std::string and must accept any type
|
||||
(e.g. via overloading).
|
||||
All types that do not provide `StringMaker` specialization or `operator<<`
|
||||
overload will be sent to this function (this includes enums and ranges).
|
||||
The provided function must return `std::string` and must accept any type,
|
||||
e.g. via overloading.
|
||||
|
||||
_Note that if the provided function does not handle a type and this type
|
||||
requires to be stringified, the compilation will fail._
|
||||
@@ -99,6 +102,19 @@ This means that defining `CATCH_CONFIG_DEFAULT_REPORTER` to `"console"`
|
||||
is equivalent with the out-of-the-box experience.
|
||||
|
||||
|
||||
## C++11 toggles
|
||||
|
||||
CATCH_CONFIG_CPP11_TO_STRING // Use `std::to_string`
|
||||
|
||||
Because we support platforms whose standard library does not contain
|
||||
`std::to_string`, it is possible to force Catch to use a workaround
|
||||
based on `std::stringstream`. On platforms other than Android,
|
||||
the default is to use `std::to_string`. On Android, the default is to
|
||||
use the `stringstream` workaround. As always, it is possible to override
|
||||
Catch's selection, by defining either `CATCH_CONFIG_CPP11_TO_STRING` or
|
||||
`CATCH_CONFIG_NO_CPP11_TO_STRING`.
|
||||
|
||||
|
||||
## C++17 toggles
|
||||
|
||||
CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS // Use std::uncaught_exceptions instead of std::uncaught_exception
|
||||
@@ -121,6 +137,7 @@ by using `_NO_` in the macro, e.g. `CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS`.
|
||||
CATCH_CONFIG_DISABLE_STRINGIFICATION // Disable stringifying the original expression
|
||||
CATCH_CONFIG_DISABLE // Disables assertions and test case registration
|
||||
CATCH_CONFIG_WCHAR // Enables use of wchart_t
|
||||
CATCH_CONFIG_EXPERIMENTAL_REDIRECT // Enables the new (experimental) way of capturing stdout/stderr
|
||||
|
||||
Currently Catch enables `CATCH_CONFIG_WINDOWS_SEH` only when compiled with MSVC, because some versions of MinGW do not have the necessary Win32 API support.
|
||||
|
||||
@@ -131,7 +148,9 @@ Currently Catch enables `CATCH_CONFIG_WINDOWS_SEH` only when compiled with MSVC,
|
||||
`CATCH_CONFIG_WCHAR` is on by default, but can be disabled. Currently
|
||||
it is only used in support for DJGPP cross-compiler.
|
||||
|
||||
These toggles can be disabled by using `_NO_` form of the toggle, e.g. `CATCH_CONFIG_NO_WINDOWS_SEH`.
|
||||
With the exception of `CATCH_CONFIG_EXPERIMENTAL_REDIRECT`,
|
||||
these toggles can be disabled by using `_NO_` form of the toggle,
|
||||
e.g. `CATCH_CONFIG_NO_WINDOWS_SEH`.
|
||||
|
||||
### `CATCH_CONFIG_FAST_COMPILE`
|
||||
Defining this flag speeds up compilation of test files by ~20%, by making 2 changes:
|
||||
|
@@ -1,18 +1,25 @@
|
||||
<a id="top"></a>
|
||||
# List of examples
|
||||
|
||||
## Already available
|
||||
|
||||
- Test Case: [Single-file](../examples/010-TestCase.cpp)
|
||||
- Test Case: [Multiple-file 1](../examples/020-TestCase-1.cpp), [2](../examples/020-TestCase-1.cpp)
|
||||
- Assertion: [REQUIRE, CHECK](../examples/030-Asn-Require-Check.cpp)
|
||||
- Fixture: [Sections](../examples/100-Fix-Section.cpp)
|
||||
- Fixture: [Class-based fixtures](../examples/110-Fix-ClassFixture.cpp)
|
||||
- BDD: [SCENARIO, GIVEN, WHEN, THEN](../examples/120-Bdd-ScenarioGivenWhenThen.cpp)
|
||||
- Listener: [Listeners](../examples/210-Evt-EventListeners.cpp)
|
||||
|
||||
|
||||
## Planned
|
||||
|
||||
- Assertion: [REQUIRE_THAT and Matchers](../examples/040-Asn-RequireThat.cpp)
|
||||
- Assertion: [REQUIRE_NO_THROW](../examples/050-Asn-RequireNoThrow.cpp)
|
||||
- Assertion: [REQUIRE_THROWS](../examples/050-Asn-RequireThrows.cpp)
|
||||
- Assertion: [REQUIRE_THROWS_AS](../examples/070-Asn-RequireThrowsAs.cpp)
|
||||
- Assertion: [REQUIRE_THROWS_WITH](../examples/080-Asn-RequireThrowsWith.cpp)
|
||||
- Assertion: [REQUIRE_THROWS_MATCHES](../examples/090-Asn-RequireThrowsMatches.cpp)
|
||||
- Fixture: [Sections](../examples/100-Fix-Section.cpp)
|
||||
- Fixture: [Class-based fixtures](../examples/110-Fix-ClassFixture.cpp)
|
||||
- BDD: [SCENARIO, GIVEN, WHEN, THEN](../examples/120-Bdd-ScenarioGivenWhenThen.cpp)
|
||||
- Floating point: [Approx - Comparisons](../examples/130-Fpt-Approx.cpp)
|
||||
- Logging: [CAPTURE - Capture expression](../examples/140-Log-Capture.cpp)
|
||||
- Logging: [INFO - Provide information with failure](../examples/150-Log-Info.cpp)
|
||||
@@ -21,7 +28,6 @@
|
||||
- Logging: [SUCCEED - Issue message and continue](../examples/180-Log-Succeed.cpp)
|
||||
- Report: [User-defined type](../examples/190-Rpt-ReportUserDefinedType.cpp)
|
||||
- Report: [Reporter](../examples/200-Rpt-UserDefinedReporter.cpp)
|
||||
- Listener: [Listeners](../examples/210-Evt-EventListeners.cpp)
|
||||
- Configuration: [Provide your own main()](../examples/220-Cfg-OwnMain.cpp)
|
||||
- Configuration: [Compile-time configuration](../examples/230-Cfg-CompileTimeConfiguration.cpp)
|
||||
- Configuration: [Run-time configuration](../examples/240-Cfg-RunTimeConfiguration.cpp)
|
||||
|
@@ -47,6 +47,9 @@ A header-only template engine for modern C++.
|
||||
### [JSON for Modern C++](https://github.com/nlohmann/json)
|
||||
A, single-header, JSON parsing library that takes advantage of what C++ has to offer.
|
||||
|
||||
### [libcluon](https://github.com/chrberger/libcluon)
|
||||
A single-header-only library written in C++14 to glue distributed software components (UDP, TCP, shared memory) supporting natively Protobuf, LCM/ZCM, MsgPack, and JSON for dynamic message transformations in-between.
|
||||
|
||||
### [MNMLSTC Core](https://github.com/mnmlstc/core)
|
||||
A small and easy to use C++11 library that adds a functionality set that will be available in C++14 and later, as well as some useful additions.
|
||||
|
||||
|
@@ -1,5 +1,43 @@
|
||||
<a id="top"></a>
|
||||
|
||||
# 2.2.3
|
||||
|
||||
**To fix some of the bugs, some behavior had to change in potentially breaking manner.**
|
||||
**This means that even though this is a patch release, it might not be a drop-in replacement.**
|
||||
|
||||
## Fixes
|
||||
* Listeners are now called before reporter
|
||||
* This was always documented to be the case, now it actually works that way
|
||||
* Catch's commandline will no longer accept multiple reporters
|
||||
* This was done because multiple reporters never worked properly and broke things in non-obvious ways
|
||||
* **This has potential to be a breaking change**
|
||||
* MinGW is now detected as Windows platform w/o SEH support (#1257)
|
||||
* This means that Catch2 no longer tries to use POSIX signal handling when compiled with MinGW
|
||||
* Fixed potential UB in parsing tags using non-ASCII characters (#1266)
|
||||
* Note that Catch2 still supports only ASCII test names/tags/etc
|
||||
* `TEST_CASE_METHOD` can now be used on classnames containing commas (#1245)
|
||||
* You have to enclose the classname in extra set of parentheses
|
||||
* Fixed insufficient alt stack size for POSIX signal handling (#1225)
|
||||
* Fixed compilation error on Android due to missing `std::to_string` in C++11 mode (#1280)
|
||||
* Fixed the order of user-provided `FALLBACK_STRINGIFIER` in stringification machinery (#1024)
|
||||
* It was intended to be replacement for built-in fallbacks, but it was used _after_ them.
|
||||
* **This has potential to be a breaking change**
|
||||
* Fixed compilation error when a type has an `operator<<` with templated lhs (#1285, #1306)
|
||||
|
||||
## Improvements
|
||||
* Added a new, experimental, output capture (#1243)
|
||||
* This capture can also redirect output written via C apis, e.g. `printf`
|
||||
* To opt-in, define `CATCH_CONFIG_EXPERIMENTAL_REDIRECT` in the implementation file
|
||||
* Added a new fallback stringifier for classes derived from `std::exception`
|
||||
* Both `StringMaker` specialization and `operator<<` overload are given priority
|
||||
|
||||
## Miscellaneous
|
||||
* `contrib/` now contains dbg scripts that skip over Catch's internals (#904, #1283)
|
||||
* `gdbinit` for gdb `lldbinit` for lldb
|
||||
* `CatchAddTests.cmake` no longer strips whitespace from tests (#1265, #1281)
|
||||
* Online documentation now describes `--use-colour` option (#1263)
|
||||
|
||||
|
||||
# 2.2.2
|
||||
|
||||
## Fixes
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
#define CATCH_VERSION_MAJOR 2
|
||||
#define CATCH_VERSION_MINOR 2
|
||||
#define CATCH_VERSION_PATCH 2
|
||||
#define CATCH_VERSION_PATCH 3
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang system_header
|
||||
|
@@ -130,7 +130,7 @@ namespace Catch {
|
||||
| Opt( config.outputFilename, "filename" )
|
||||
["-o"]["--out"]
|
||||
( "output filename" )
|
||||
| Opt( config.reporterNames, "name" )
|
||||
| Opt( config.reporterName, "name" )
|
||||
["-r"]["--reporter"]
|
||||
( "reporter to use (defaults to console)" )
|
||||
| Opt( config.name, "name" )
|
||||
|
@@ -24,6 +24,7 @@
|
||||
// Many features, at point of detection, define an _INTERNAL_ macro, so they
|
||||
// can be combined, en-mass, with the _NO_ forms later.
|
||||
|
||||
#include "catch_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -76,6 +77,18 @@
|
||||
# define CATCH_CONFIG_COLOUR_NONE
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Android somehow still does not support std::to_string
|
||||
#if defined(__ANDROID__)
|
||||
# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Not all Windows environments support SEH properly
|
||||
#if defined(__MINGW32__)
|
||||
# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Cygwin
|
||||
#ifdef __CYGWIN__
|
||||
@@ -126,7 +139,7 @@
|
||||
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
|
||||
# define CATCH_CONFIG_COUNTER
|
||||
#endif
|
||||
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)
|
||||
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)
|
||||
# define CATCH_CONFIG_WINDOWS_SEH
|
||||
#endif
|
||||
// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
|
||||
@@ -138,6 +151,10 @@
|
||||
# define CATCH_CONFIG_WCHAR
|
||||
#endif
|
||||
|
||||
#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING)
|
||||
# define CATCH_CONFIG_CPP11_TO_STRING
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||
# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||
#endif
|
||||
|
@@ -37,8 +37,8 @@ namespace Catch {
|
||||
bool Config::listReporters() const { return m_data.listReporters; }
|
||||
|
||||
std::string Config::getProcessName() const { return m_data.processName; }
|
||||
std::string const& Config::getReporterName() const { return m_data.reporterName; }
|
||||
|
||||
std::vector<std::string> const& Config::getReporterNames() const { return m_data.reporterNames; }
|
||||
std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }
|
||||
std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }
|
||||
|
||||
|
@@ -54,8 +54,12 @@ namespace Catch {
|
||||
std::string outputFilename;
|
||||
std::string name;
|
||||
std::string processName;
|
||||
#ifndef CATCH_CONFIG_DEFAULT_REPORTER
|
||||
#define CATCH_CONFIG_DEFAULT_REPORTER "console"
|
||||
#endif
|
||||
std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER;
|
||||
#undef CATCH_CONFIG_DEFAULT_REPORTER
|
||||
|
||||
std::vector<std::string> reporterNames;
|
||||
std::vector<std::string> testsOrTags;
|
||||
std::vector<std::string> sectionsToRun;
|
||||
};
|
||||
@@ -76,8 +80,8 @@ namespace Catch {
|
||||
bool listReporters() const;
|
||||
|
||||
std::string getProcessName() const;
|
||||
std::string const& getReporterName() const;
|
||||
|
||||
std::vector<std::string> const& getReporterNames() const;
|
||||
std::vector<std::string> const& getTestsOrTags() const;
|
||||
std::vector<std::string> const& getSectionsToRun() const override;
|
||||
|
||||
|
@@ -94,6 +94,11 @@ namespace Catch {
|
||||
int id;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
// 32kb for the alternate stack seems to be sufficient. However, this value
|
||||
// is experimentally determined, so that's not guaranteed.
|
||||
constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
|
||||
|
||||
static SignalDefs signalDefs[] = {
|
||||
{ SIGINT, "SIGINT - Terminal interrupt signal" },
|
||||
{ SIGILL, "SIGILL - Illegal instruction signal" },
|
||||
@@ -121,7 +126,7 @@ namespace Catch {
|
||||
isSet = true;
|
||||
stack_t sigStack;
|
||||
sigStack.ss_sp = altStackMem;
|
||||
sigStack.ss_size = SIGSTKSZ;
|
||||
sigStack.ss_size = sigStackSize;
|
||||
sigStack.ss_flags = 0;
|
||||
sigaltstack(&sigStack, &oldSigStack);
|
||||
struct sigaction sa = { };
|
||||
@@ -153,7 +158,7 @@ namespace Catch {
|
||||
bool FatalConditionHandler::isSet = false;
|
||||
struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
|
||||
stack_t FatalConditionHandler::oldSigStack = {};
|
||||
char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
|
||||
char FatalConditionHandler::altStackMem[sigStackSize] = {};
|
||||
|
||||
|
||||
} // namespace Catch
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "catch_interfaces_reporter.h"
|
||||
#include "../reporters/catch_reporter_multi.h"
|
||||
#include "../reporters/catch_reporter_listening.h"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -111,25 +111,4 @@ namespace Catch {
|
||||
IReporterFactory::~IReporterFactory() = default;
|
||||
IReporterRegistry::~IReporterRegistry() = default;
|
||||
|
||||
void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) {
|
||||
|
||||
if( !existingReporter ) {
|
||||
existingReporter = std::move( additionalReporter );
|
||||
return;
|
||||
}
|
||||
|
||||
MultipleReporters* multi = nullptr;
|
||||
|
||||
if( existingReporter->isMulti() ) {
|
||||
multi = static_cast<MultipleReporters*>( existingReporter.get() );
|
||||
}
|
||||
else {
|
||||
auto newMulti = std::unique_ptr<MultipleReporters>( new MultipleReporters );
|
||||
newMulti->add( std::move( existingReporter ) );
|
||||
multi = newMulti.get();
|
||||
existingReporter = std::move( newMulti );
|
||||
}
|
||||
multi->add( std::move( additionalReporter ) );
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
|
@@ -226,8 +226,6 @@ namespace Catch {
|
||||
virtual Listeners const& getListeners() const = 0;
|
||||
};
|
||||
|
||||
void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter );
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
|
||||
|
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "catch_matchers_floating.h"
|
||||
#include "catch_to_string.hpp"
|
||||
#include "catch_tostring.h"
|
||||
|
||||
#include <cstdlib>
|
||||
@@ -115,7 +116,7 @@ namespace Floating {
|
||||
}
|
||||
|
||||
std::string WithinUlpsMatcher::describe() const {
|
||||
return "is within " + std::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
|
||||
return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
|
||||
}
|
||||
|
||||
}// namespace Floating
|
||||
|
132
include/internal/catch_output_redirect.cpp
Normal file
132
include/internal/catch_output_redirect.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Created by Martin on 28/04/2018.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#include "catch_output_redirect.h"
|
||||
|
||||
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <io.h> //_dup and _dup2
|
||||
#define dup _dup
|
||||
#define dup2 _dup2
|
||||
#define fileno _fileno
|
||||
#else
|
||||
#include <unistd.h> // dup and dup2
|
||||
#endif
|
||||
|
||||
namespace Catch {
|
||||
|
||||
RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )
|
||||
: m_originalStream( originalStream ),
|
||||
m_redirectionStream( redirectionStream ),
|
||||
m_prevBuf( m_originalStream.rdbuf() )
|
||||
{
|
||||
m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
|
||||
}
|
||||
|
||||
RedirectedStream::~RedirectedStream() {
|
||||
m_originalStream.rdbuf( m_prevBuf );
|
||||
}
|
||||
|
||||
RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}
|
||||
auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); }
|
||||
|
||||
RedirectedStdErr::RedirectedStdErr()
|
||||
: m_cerr( Catch::cerr(), m_rss.get() ),
|
||||
m_clog( Catch::clog(), m_rss.get() )
|
||||
{}
|
||||
auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); }
|
||||
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
TempFile::TempFile() {
|
||||
if (tmpnam_s(m_buffer)) {
|
||||
throw std::runtime_error("Could not get a temp filename");
|
||||
}
|
||||
if (fopen_s(&m_file, m_buffer, "w")) {
|
||||
char buffer[100];
|
||||
if (strerror_s(buffer, errno)) {
|
||||
throw std::runtime_error("Could not translate errno to string");
|
||||
}
|
||||
throw std::runtime_error("Could not open the temp file: " + std::string(m_buffer) + buffer);
|
||||
}
|
||||
}
|
||||
#else
|
||||
TempFile::TempFile() {
|
||||
m_file = std::tmpfile();
|
||||
if (!m_file) {
|
||||
throw std::runtime_error("Could not create a temp file.");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TempFile::~TempFile() {
|
||||
// TBD: What to do about errors here?
|
||||
std::fclose(m_file);
|
||||
// We manually create the file on Windows only, on Linux
|
||||
// it will be autodeleted
|
||||
#if defined(_MSC_VER)
|
||||
std::remove(m_buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
FILE* TempFile::getFile() {
|
||||
return m_file;
|
||||
}
|
||||
|
||||
std::string TempFile::getContents() {
|
||||
std::stringstream sstr;
|
||||
char buffer[100] = {};
|
||||
std::rewind(m_file);
|
||||
while (std::fgets(buffer, sizeof(buffer), m_file)) {
|
||||
sstr << buffer;
|
||||
}
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) :
|
||||
m_originalStdout(dup(1)),
|
||||
m_originalStderr(dup(2)),
|
||||
m_stdoutDest(stdout_dest),
|
||||
m_stderrDest(stderr_dest) {
|
||||
dup2(fileno(m_stdoutFile.getFile()), 1);
|
||||
dup2(fileno(m_stderrFile.getFile()), 2);
|
||||
}
|
||||
|
||||
OutputRedirect::~OutputRedirect() {
|
||||
Catch::cout() << std::flush;
|
||||
fflush(stdout);
|
||||
// Since we support overriding these streams, we flush cerr
|
||||
// even though std::cerr is unbuffered
|
||||
Catch::cerr() << std::flush;
|
||||
Catch::clog() << std::flush;
|
||||
fflush(stderr);
|
||||
|
||||
dup2(m_originalStdout, 1);
|
||||
dup2(m_originalStderr, 2);
|
||||
|
||||
m_stdoutDest += m_stdoutFile.getContents();
|
||||
m_stderrDest += m_stderrFile.getContents();
|
||||
}
|
||||
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#undef dup
|
||||
#undef dup2
|
||||
#undef fileno
|
||||
#endif
|
98
include/internal/catch_output_redirect.h
Normal file
98
include/internal/catch_output_redirect.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Created by Martin on 28/04/2018.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
|
||||
#define TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
|
||||
|
||||
#include "catch_platform.h"
|
||||
#include "catch_stream.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class RedirectedStream {
|
||||
std::ostream& m_originalStream;
|
||||
std::ostream& m_redirectionStream;
|
||||
std::streambuf* m_prevBuf;
|
||||
|
||||
public:
|
||||
RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream );
|
||||
~RedirectedStream();
|
||||
};
|
||||
|
||||
class RedirectedStdOut {
|
||||
ReusableStringStream m_rss;
|
||||
RedirectedStream m_cout;
|
||||
public:
|
||||
RedirectedStdOut();
|
||||
auto str() const -> std::string;
|
||||
};
|
||||
|
||||
// StdErr has two constituent streams in C++, std::cerr and std::clog
|
||||
// This means that we need to redirect 2 streams into 1 to keep proper
|
||||
// order of writes
|
||||
class RedirectedStdErr {
|
||||
ReusableStringStream m_rss;
|
||||
RedirectedStream m_cerr;
|
||||
RedirectedStream m_clog;
|
||||
public:
|
||||
RedirectedStdErr();
|
||||
auto str() const -> std::string;
|
||||
};
|
||||
|
||||
|
||||
// Windows's implementation of std::tmpfile is terrible (it tries
|
||||
// to create a file inside system folder, thus requiring elevated
|
||||
// privileges for the binary), so we have to use tmpnam(_s) and
|
||||
// create the file ourselves there.
|
||||
class TempFile {
|
||||
public:
|
||||
TempFile(TempFile const&) = delete;
|
||||
TempFile& operator=(TempFile const&) = delete;
|
||||
TempFile(TempFile&&) = delete;
|
||||
TempFile& operator=(TempFile&&) = delete;
|
||||
|
||||
TempFile();
|
||||
~TempFile();
|
||||
|
||||
std::FILE* getFile();
|
||||
std::string getContents();
|
||||
|
||||
private:
|
||||
std::FILE* m_file = nullptr;
|
||||
#if defined(_MSC_VER)
|
||||
char m_buffer[L_tmpnam] = { 0 };
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
class OutputRedirect {
|
||||
public:
|
||||
OutputRedirect(OutputRedirect const&) = delete;
|
||||
OutputRedirect& operator=(OutputRedirect const&) = delete;
|
||||
OutputRedirect(OutputRedirect&&) = delete;
|
||||
OutputRedirect& operator=(OutputRedirect&&) = delete;
|
||||
|
||||
|
||||
OutputRedirect(std::string& stdout_dest, std::string& stderr_dest);
|
||||
~OutputRedirect();
|
||||
|
||||
private:
|
||||
int m_originalStdout = -1;
|
||||
int m_originalStderr = -1;
|
||||
TempFile m_stdoutFile;
|
||||
TempFile m_stderrFile;
|
||||
std::string& m_stdoutDest;
|
||||
std::string& m_stderrDest;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
|
@@ -20,7 +20,7 @@
|
||||
#elif defined(linux) || defined(__linux) || defined(__linux__)
|
||||
# define CATCH_PLATFORM_LINUX
|
||||
|
||||
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
|
||||
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
|
||||
# define CATCH_PLATFORM_WINDOWS
|
||||
#endif
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "catch_enforce.h"
|
||||
#include "catch_random_number_generator.h"
|
||||
#include "catch_stream.h"
|
||||
#include "catch_output_redirect.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
@@ -10,48 +11,6 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class RedirectedStream {
|
||||
std::ostream& m_originalStream;
|
||||
std::ostream& m_redirectionStream;
|
||||
std::streambuf* m_prevBuf;
|
||||
|
||||
public:
|
||||
RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )
|
||||
: m_originalStream( originalStream ),
|
||||
m_redirectionStream( redirectionStream ),
|
||||
m_prevBuf( m_originalStream.rdbuf() )
|
||||
{
|
||||
m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
|
||||
}
|
||||
~RedirectedStream() {
|
||||
m_originalStream.rdbuf( m_prevBuf );
|
||||
}
|
||||
};
|
||||
|
||||
class RedirectedStdOut {
|
||||
ReusableStringStream m_rss;
|
||||
RedirectedStream m_cout;
|
||||
public:
|
||||
RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}
|
||||
auto str() const -> std::string { return m_rss.str(); }
|
||||
};
|
||||
|
||||
// StdErr has two constituent streams in C++, std::cerr and std::clog
|
||||
// This means that we need to redirect 2 streams into 1 to keep proper
|
||||
// order of writes
|
||||
class RedirectedStdErr {
|
||||
ReusableStringStream m_rss;
|
||||
RedirectedStream m_cerr;
|
||||
RedirectedStream m_clog;
|
||||
public:
|
||||
RedirectedStdErr()
|
||||
: m_cerr( Catch::cerr(), m_rss.get() ),
|
||||
m_clog( Catch::clog(), m_rss.get() )
|
||||
{}
|
||||
auto str() const -> std::string { return m_rss.str(); }
|
||||
};
|
||||
|
||||
|
||||
RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)
|
||||
: m_runInfo(_config->name()),
|
||||
m_context(getCurrentMutableContext()),
|
||||
@@ -299,13 +258,19 @@ namespace Catch {
|
||||
Timer timer;
|
||||
try {
|
||||
if (m_reporter->getPreferences().shouldRedirectStdOut) {
|
||||
#if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
|
||||
RedirectedStdOut redirectedStdOut;
|
||||
RedirectedStdErr redirectedStdErr;
|
||||
|
||||
timer.start();
|
||||
invokeActiveTestCase();
|
||||
redirectedCout += redirectedStdOut.str();
|
||||
redirectedCerr += redirectedStdErr.str();
|
||||
|
||||
#else
|
||||
OutputRedirect r(redirectedCout, redirectedCerr);
|
||||
timer.start();
|
||||
invokeActiveTestCase();
|
||||
#endif
|
||||
} else {
|
||||
timer.start();
|
||||
invokeActiveTestCase();
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "catch_text.h"
|
||||
#include "catch_stream.h"
|
||||
#include "catch_windows_h_proxy.h"
|
||||
#include "../reporters/catch_reporter_listening.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iomanip>
|
||||
@@ -36,33 +37,26 @@ namespace Catch {
|
||||
return reporter;
|
||||
}
|
||||
|
||||
#ifndef CATCH_CONFIG_DEFAULT_REPORTER
|
||||
#define CATCH_CONFIG_DEFAULT_REPORTER "console"
|
||||
#endif
|
||||
|
||||
IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {
|
||||
auto const& reporterNames = config->getReporterNames();
|
||||
if (reporterNames.empty())
|
||||
return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config);
|
||||
if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) {
|
||||
return createReporter(config->getReporterName(), config);
|
||||
}
|
||||
|
||||
IStreamingReporterPtr reporter;
|
||||
for (auto const& name : reporterNames)
|
||||
addReporter(reporter, createReporter(name, config));
|
||||
return reporter;
|
||||
}
|
||||
auto multi = std::unique_ptr<ListeningReporter>(new ListeningReporter);
|
||||
|
||||
#undef CATCH_CONFIG_DEFAULT_REPORTER
|
||||
|
||||
void addListeners(IStreamingReporterPtr& reporters, IConfigPtr const& config) {
|
||||
auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
|
||||
for (auto const& listener : listeners)
|
||||
addReporter(reporters, listener->create(Catch::ReporterConfig(config)));
|
||||
for (auto const& listener : listeners) {
|
||||
multi->addListener(listener->create(Catch::ReporterConfig(config)));
|
||||
}
|
||||
multi->addReporter(createReporter(config->getReporterName(), config));
|
||||
return std::move(multi);
|
||||
}
|
||||
|
||||
|
||||
Catch::Totals runTests(std::shared_ptr<Config> const& config) {
|
||||
IStreamingReporterPtr reporter = makeReporter(config);
|
||||
addListeners(reporter, config);
|
||||
// FixMe: Add listeners in order first, then add reporters.
|
||||
|
||||
auto reporter = makeReporter(config);
|
||||
|
||||
RunContext context(config, std::move(reporter));
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
return TestCaseInfo::None;
|
||||
}
|
||||
bool isReservedTag( std::string const& tag ) {
|
||||
return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] );
|
||||
return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast<unsigned char>(tag[0]) );
|
||||
}
|
||||
void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
||||
CATCH_ENFORCE( !isReservedTag(tag),
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include "catch_enforce.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
@@ -47,12 +47,17 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
|
||||
#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
|
||||
#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
|
||||
#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
|
||||
|
||||
#if defined(CATCH_CONFIG_DISABLE)
|
||||
#define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
|
||||
namespace{ \
|
||||
struct TestName : ClassName { \
|
||||
struct TestName : INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF ClassName) { \
|
||||
void test(); \
|
||||
}; \
|
||||
} \
|
||||
@@ -80,7 +85,7 @@ struct AutoReg : NonCopyable {
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
namespace{ \
|
||||
struct TestName : ClassName{ \
|
||||
struct TestName : INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF ClassName) { \
|
||||
void test(); \
|
||||
}; \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
|
28
include/internal/catch_to_string.hpp
Normal file
28
include/internal/catch_to_string.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Created by Martin on 9/5/2018.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef TWOBLUECUBES_CATCH_TO_STRING_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_TO_STRING_H_INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "catch_compiler_capabilities.h"
|
||||
#include "catch_stream.h"
|
||||
|
||||
namespace Catch {
|
||||
template <typename T>
|
||||
std::string to_string(T const& t) {
|
||||
#if defined(CATCH_CONFIG_CPP11_TO_STRING)
|
||||
return std::to_string(t);
|
||||
#else
|
||||
ReusableStringStream rss;
|
||||
rss << t;
|
||||
return rss.str();
|
||||
#endif
|
||||
}
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_TO_STRING_H_INCLUDED
|
@@ -62,20 +62,26 @@ namespace Catch {
|
||||
std::string convertUnknownEnumToString( E e );
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<!std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) {
|
||||
#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
|
||||
(void)value;
|
||||
typename std::enable_if<
|
||||
!std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value,
|
||||
std::string>::type convertUnstreamable( T const& ) {
|
||||
return Detail::unprintableString;
|
||||
#else
|
||||
return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);
|
||||
#endif
|
||||
}
|
||||
template<typename T>
|
||||
typename std::enable_if<std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) {
|
||||
return convertUnknownEnumToString( value );
|
||||
typename std::enable_if<
|
||||
!std::is_enum<T>::value && std::is_base_of<std::exception, T>::value,
|
||||
std::string>::type convertUnstreamable(T const& ex) {
|
||||
return ex.what();
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_enum<T>::value
|
||||
, std::string>::type convertUnstreamable( T const& value ) {
|
||||
return convertUnknownEnumToString( value );
|
||||
}
|
||||
|
||||
#if defined(_MANAGED)
|
||||
//! Convert a CLR string to a utf8 std::string
|
||||
template<typename T>
|
||||
@@ -99,7 +105,9 @@ namespace Catch {
|
||||
typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
|
||||
convert(const Fake& value) {
|
||||
ReusableStringStream rss;
|
||||
rss << value;
|
||||
// NB: call using the function-like syntax to avoid ambiguity with
|
||||
// user-defined templated operator<< under clang.
|
||||
rss.operator<<(value);
|
||||
return rss.str();
|
||||
}
|
||||
|
||||
@@ -107,7 +115,11 @@ namespace Catch {
|
||||
static
|
||||
typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
|
||||
convert( const Fake& value ) {
|
||||
return Detail::convertUnstreamable( value );
|
||||
#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
|
||||
return Detail::convertUnstreamable(value);
|
||||
#else
|
||||
return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 2, 2, 2, "", 0 );
|
||||
static Version version( 2, 2, 3, "", 0 );
|
||||
return version;
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#include <cstring>
|
||||
#include <cfloat>
|
||||
#include <cstdio>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
||||
namespace Catch {
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include <cstring>
|
||||
#include <cfloat>
|
||||
#include <cstdio>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#include "../internal/catch_tostring.h"
|
||||
#include "../internal/catch_reporter_registrars.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
|
136
include/reporters/catch_reporter_listening.cpp
Normal file
136
include/reporters/catch_reporter_listening.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Created by Phil on 5/08/2015.
|
||||
* Copyright 2015 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#include "catch_reporter_listening.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) {
|
||||
m_listeners.push_back( std::move( listener ) );
|
||||
}
|
||||
|
||||
void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) {
|
||||
assert(!m_reporter && "Listening reporter can wrap only 1 real reporter");
|
||||
m_reporter = std::move( reporter );
|
||||
}
|
||||
|
||||
ReporterPreferences ListeningReporter::getPreferences() const {
|
||||
return m_reporter->getPreferences();
|
||||
}
|
||||
|
||||
std::set<Verbosity> ListeningReporter::getSupportedVerbosities() {
|
||||
return std::set<Verbosity>{ };
|
||||
}
|
||||
|
||||
|
||||
void ListeningReporter::noMatchingTestCases( std::string const& spec ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->noMatchingTestCases( spec );
|
||||
}
|
||||
m_reporter->noMatchingTestCases( spec );
|
||||
}
|
||||
|
||||
void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->benchmarkStarting( benchmarkInfo );
|
||||
}
|
||||
m_reporter->benchmarkStarting( benchmarkInfo );
|
||||
}
|
||||
void ListeningReporter::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->benchmarkEnded( benchmarkStats );
|
||||
}
|
||||
m_reporter->benchmarkEnded( benchmarkStats );
|
||||
}
|
||||
|
||||
void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testRunStarting( testRunInfo );
|
||||
}
|
||||
m_reporter->testRunStarting( testRunInfo );
|
||||
}
|
||||
|
||||
void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testGroupStarting( groupInfo );
|
||||
}
|
||||
m_reporter->testGroupStarting( groupInfo );
|
||||
}
|
||||
|
||||
|
||||
void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testCaseStarting( testInfo );
|
||||
}
|
||||
m_reporter->testCaseStarting( testInfo );
|
||||
}
|
||||
|
||||
void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->sectionStarting( sectionInfo );
|
||||
}
|
||||
m_reporter->sectionStarting( sectionInfo );
|
||||
}
|
||||
|
||||
void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->assertionStarting( assertionInfo );
|
||||
}
|
||||
m_reporter->assertionStarting( assertionInfo );
|
||||
}
|
||||
|
||||
// The return value indicates if the messages buffer should be cleared:
|
||||
bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) {
|
||||
for( auto const& listener : m_listeners ) {
|
||||
static_cast<void>( listener->assertionEnded( assertionStats ) );
|
||||
}
|
||||
return m_reporter->assertionEnded( assertionStats );
|
||||
}
|
||||
|
||||
void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->sectionEnded( sectionStats );
|
||||
}
|
||||
m_reporter->sectionEnded( sectionStats );
|
||||
}
|
||||
|
||||
void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testCaseEnded( testCaseStats );
|
||||
}
|
||||
m_reporter->testCaseEnded( testCaseStats );
|
||||
}
|
||||
|
||||
void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testGroupEnded( testGroupStats );
|
||||
}
|
||||
m_reporter->testGroupEnded( testGroupStats );
|
||||
}
|
||||
|
||||
void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testRunEnded( testRunStats );
|
||||
}
|
||||
m_reporter->testRunEnded( testRunStats );
|
||||
}
|
||||
|
||||
|
||||
void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->skipTest( testInfo );
|
||||
}
|
||||
m_reporter->skipTest( testInfo );
|
||||
}
|
||||
|
||||
bool ListeningReporter::isMulti() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
@@ -11,12 +11,14 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class MultipleReporters : public IStreamingReporter {
|
||||
class ListeningReporter : public IStreamingReporter {
|
||||
using Reporters = std::vector<IStreamingReporterPtr>;
|
||||
Reporters m_reporters;
|
||||
Reporters m_listeners;
|
||||
IStreamingReporterPtr m_reporter = nullptr;
|
||||
|
||||
public:
|
||||
void add( IStreamingReporterPtr&& reporter );
|
||||
void addListener( IStreamingReporterPtr&& listener );
|
||||
void addReporter( IStreamingReporterPtr&& reporter );
|
||||
|
||||
public: // IStreamingReporter
|
||||
|
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Created by Phil on 5/08/2015.
|
||||
* Copyright 2015 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#include "catch_reporter_multi.h"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
void MultipleReporters::add( IStreamingReporterPtr&& reporter ) {
|
||||
m_reporters.push_back( std::move( reporter ) );
|
||||
}
|
||||
|
||||
ReporterPreferences MultipleReporters::getPreferences() const {
|
||||
return m_reporters[0]->getPreferences();
|
||||
}
|
||||
|
||||
std::set<Verbosity> MultipleReporters::getSupportedVerbosities() {
|
||||
return std::set<Verbosity>{ };
|
||||
}
|
||||
|
||||
|
||||
void MultipleReporters::noMatchingTestCases( std::string const& spec ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->noMatchingTestCases( spec );
|
||||
}
|
||||
|
||||
void MultipleReporters::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->benchmarkStarting( benchmarkInfo );
|
||||
}
|
||||
void MultipleReporters::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->benchmarkEnded( benchmarkStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testRunStarting( testRunInfo );
|
||||
}
|
||||
|
||||
void MultipleReporters::testGroupStarting( GroupInfo const& groupInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testGroupStarting( groupInfo );
|
||||
}
|
||||
|
||||
|
||||
void MultipleReporters::testCaseStarting( TestCaseInfo const& testInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testCaseStarting( testInfo );
|
||||
}
|
||||
|
||||
void MultipleReporters::sectionStarting( SectionInfo const& sectionInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->sectionStarting( sectionInfo );
|
||||
}
|
||||
|
||||
void MultipleReporters::assertionStarting( AssertionInfo const& assertionInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->assertionStarting( assertionInfo );
|
||||
}
|
||||
|
||||
// The return value indicates if the messages buffer should be cleared:
|
||||
bool MultipleReporters::assertionEnded( AssertionStats const& assertionStats ) {
|
||||
bool clearBuffer = false;
|
||||
for( auto const& reporter : m_reporters )
|
||||
clearBuffer |= reporter->assertionEnded( assertionStats );
|
||||
return clearBuffer;
|
||||
}
|
||||
|
||||
void MultipleReporters::sectionEnded( SectionStats const& sectionStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->sectionEnded( sectionStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testCaseEnded( testCaseStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::testGroupEnded( TestGroupStats const& testGroupStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testGroupEnded( testGroupStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::testRunEnded( TestRunStats const& testRunStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testRunEnded( testRunStats );
|
||||
}
|
||||
|
||||
|
||||
void MultipleReporters::skipTest( TestCaseInfo const& testInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->skipTest( testInfo );
|
||||
}
|
||||
|
||||
bool MultipleReporters::isMulti() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
@@ -12,6 +12,7 @@ Compilation.tests.cpp:<line number>: passed: t1 >= t2 for: {?} >= {?}
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Compilation.tests.cpp:<line number>: passed: std::memcmp(uarr, "123", sizeof(uarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"'
|
||||
Compilation.tests.cpp:<line number>: passed: std::memcmp(sarr, "456", sizeof(sarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"'
|
||||
Compilation.tests.cpp:<line number>: passed:
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception'
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
|
||||
Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42'
|
||||
@@ -210,14 +211,21 @@ Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Equals("this
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive)
|
||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Equals("this string contains 'ABC' as a substring") for: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring"
|
||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "something else" (case insensitive)
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(WhatException{}) == "This exception has overriden what() method" for: "This exception has overriden what() method"
|
||||
==
|
||||
"This exception has overriden what() method"
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(OperatorException{}) == "OperatorException" for: "OperatorException" == "OperatorException"
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" for: "StringMakerException"
|
||||
==
|
||||
"StringMakerException"
|
||||
Matchers.tests.cpp:<line number>: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1}
|
||||
Matchers.tests.cpp:<line number>: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1}
|
||||
Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1}
|
||||
Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1}
|
||||
Matchers.tests.cpp:<line number>: failed: throws(3), SpecialException, ExceptionMatcher{1} for: {?} special exception has value of 1
|
||||
Matchers.tests.cpp:<line number>: failed: throws(4), SpecialException, ExceptionMatcher{1} for: {?} special exception has value of 1
|
||||
Matchers.tests.cpp:<line number>: passed: throws(1), SpecialException, ExceptionMatcher{1} for: {?} special exception has value of 1
|
||||
Matchers.tests.cpp:<line number>: passed: throws(2), SpecialException, ExceptionMatcher{2} for: {?} special exception has value of 2
|
||||
Matchers.tests.cpp:<line number>: failed: throws(3), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1
|
||||
Matchers.tests.cpp:<line number>: failed: throws(4), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1
|
||||
Matchers.tests.cpp:<line number>: passed: throws(1), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1
|
||||
Matchers.tests.cpp:<line number>: passed: throws(2), SpecialException, ExceptionMatcher{2} for: SpecialException::what special exception has value of 2
|
||||
Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception"
|
||||
Exception.tests.cpp:<line number>: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive)
|
||||
Exception.tests.cpp:<line number>: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected"
|
||||
@@ -528,7 +536,7 @@ CmdLine.tests.cpp:<line number>: passed: config.processName == "test" for: "test
|
||||
CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak == false for: false == false
|
||||
CmdLine.tests.cpp:<line number>: passed: config.abortAfter == -1 for: -1 == -1
|
||||
CmdLine.tests.cpp:<line number>: passed: config.noThrow == false for: false == false
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterNames.empty() for: true
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterName == "console" for: "console" == "console"
|
||||
CmdLine.tests.cpp:<line number>: passed: !(cfg.hasTestFilters()) for: !false
|
||||
CmdLine.tests.cpp:<line number>: passed: result for: {?}
|
||||
CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true
|
||||
@@ -543,15 +551,12 @@ CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true
|
||||
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("test1")) == false for: false == false
|
||||
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) for: true
|
||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "console"}) for: {?}
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "console" for: "console" == "console"
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterName == "console" for: "console" == "console"
|
||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "xml"}) for: {?}
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "xml" for: "xml" == "xml"
|
||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "xml", "-r", "junit"}) for: {?}
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterNames.size() == 2 for: 2 == 2
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "xml" for: "xml" == "xml"
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterNames[1] == "junit" for: "junit" == "junit"
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterName == "xml" for: "xml" == "xml"
|
||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--reporter", "junit"}) for: {?}
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "junit" for: "junit" == "junit"
|
||||
CmdLine.tests.cpp:<line number>: passed: config.reporterName == "junit" for: "junit" == "junit"
|
||||
CmdLine.tests.cpp:<line number>: passed: !(cli.parse({ "test", "-r", "xml", "-r", "junit" })) for: !{?}
|
||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-b"}) for: {?}
|
||||
CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak == true for: true == true
|
||||
CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--break"}) for: {?}
|
||||
@@ -1060,6 +1065,9 @@ ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(item)
|
||||
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" for: "operator<<( has_operator )"
|
||||
==
|
||||
"operator<<( has_operator )"
|
||||
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" for: "operator<<( has_template_operator )"
|
||||
==
|
||||
"operator<<( has_template_operator )"
|
||||
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" for: "{ StringMaker<has_maker> }"
|
||||
==
|
||||
"{ StringMaker<has_maker> }"
|
||||
|
@@ -335,12 +335,12 @@ Matchers.tests.cpp:<line number>
|
||||
Matchers.tests.cpp:<line number>: FAILED:
|
||||
CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} )
|
||||
with expansion:
|
||||
{?} special exception has value of 1
|
||||
SpecialException::what special exception has value of 1
|
||||
|
||||
Matchers.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} )
|
||||
with expansion:
|
||||
{?} special exception has value of 1
|
||||
SpecialException::what special exception has value of 1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Expected exceptions that don't throw or unexpected exceptions fail the test
|
||||
@@ -1084,6 +1084,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 205 | 152 passed | 49 failed | 4 failed as expected
|
||||
assertions: 1063 | 935 passed | 107 failed | 21 failed as expected
|
||||
test cases: 208 | 155 passed | 49 failed | 4 failed as expected
|
||||
assertions: 1065 | 937 passed | 107 failed | 21 failed as expected
|
||||
|
||||
|
@@ -126,6 +126,15 @@ with messages:
|
||||
uarr := "123"
|
||||
sarr := "456"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1245
|
||||
-------------------------------------------------------------------------------
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#748 - captures with unexpected exceptions
|
||||
outside assertions
|
||||
@@ -1671,6 +1680,34 @@ with expansion:
|
||||
"this string contains 'abc' as a substring" equals: "something else" (case
|
||||
insensitive)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified
|
||||
-------------------------------------------------------------------------------
|
||||
ToStringGeneral.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToStringGeneral.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( ::Catch::Detail::stringify(WhatException{}) == "This exception has overriden what() method" )
|
||||
with expansion:
|
||||
"This exception has overriden what() method"
|
||||
==
|
||||
"This exception has overriden what() method"
|
||||
|
||||
ToStringGeneral.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( ::Catch::Detail::stringify(OperatorException{}) == "OperatorException" )
|
||||
with expansion:
|
||||
"OperatorException" == "OperatorException"
|
||||
|
||||
ToStringGeneral.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" )
|
||||
with expansion:
|
||||
"StringMakerException"
|
||||
==
|
||||
"StringMakerException"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Exception matchers that fail
|
||||
No exception
|
||||
@@ -1713,12 +1750,12 @@ Matchers.tests.cpp:<line number>
|
||||
Matchers.tests.cpp:<line number>: FAILED:
|
||||
CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} )
|
||||
with expansion:
|
||||
{?} special exception has value of 1
|
||||
SpecialException::what special exception has value of 1
|
||||
|
||||
Matchers.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} )
|
||||
with expansion:
|
||||
{?} special exception has value of 1
|
||||
SpecialException::what special exception has value of 1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Exception matchers that succeed
|
||||
@@ -1730,13 +1767,13 @@ Matchers.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK_THROWS_MATCHES( throws(1), SpecialException, ExceptionMatcher{1} )
|
||||
with expansion:
|
||||
{?} special exception has value of 1
|
||||
SpecialException::what special exception has value of 1
|
||||
|
||||
Matchers.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THROWS_MATCHES( throws(2), SpecialException, ExceptionMatcher{2} )
|
||||
with expansion:
|
||||
{?} special exception has value of 2
|
||||
SpecialException::what special exception has value of 2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Exception messages can be tested for
|
||||
@@ -4080,9 +4117,9 @@ with expansion:
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( config.reporterNames.empty() )
|
||||
CHECK( config.reporterName == "console" )
|
||||
with expansion:
|
||||
true
|
||||
"console" == "console"
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
@@ -4202,7 +4239,7 @@ with expansion:
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( config.reporterNames[0] == "console" )
|
||||
REQUIRE( config.reporterName == "console" )
|
||||
with expansion:
|
||||
"console" == "console"
|
||||
|
||||
@@ -4222,42 +4259,10 @@ with expansion:
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( config.reporterNames[0] == "xml" )
|
||||
REQUIRE( config.reporterName == "xml" )
|
||||
with expansion:
|
||||
"xml" == "xml"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Process can be configured on command line
|
||||
reporter
|
||||
-r xml and junit
|
||||
-------------------------------------------------------------------------------
|
||||
CmdLine.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( cli.parse({"test", "-r", "xml", "-r", "junit"}) )
|
||||
with expansion:
|
||||
{?}
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( config.reporterNames.size() == 2 )
|
||||
with expansion:
|
||||
2 == 2
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( config.reporterNames[0] == "xml" )
|
||||
with expansion:
|
||||
"xml" == "xml"
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( config.reporterNames[1] == "junit" )
|
||||
with expansion:
|
||||
"junit" == "junit"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Process can be configured on command line
|
||||
reporter
|
||||
@@ -4274,10 +4279,24 @@ with expansion:
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( config.reporterNames[0] == "junit" )
|
||||
REQUIRE( config.reporterName == "junit" )
|
||||
with expansion:
|
||||
"junit" == "junit"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Process can be configured on command line
|
||||
reporter
|
||||
Only one reporter is accepted
|
||||
-------------------------------------------------------------------------------
|
||||
CmdLine.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
CmdLine.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_FALSE( cli.parse({ "test", "-r", "xml", "-r", "junit" }) )
|
||||
with expansion:
|
||||
!{?}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Process can be configured on command line
|
||||
debugger
|
||||
@@ -8388,6 +8407,20 @@ with expansion:
|
||||
==
|
||||
"operator<<( has_operator )"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
stringify( has_template_operator )
|
||||
-------------------------------------------------------------------------------
|
||||
ToStringWhich.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToStringWhich.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" )
|
||||
with expansion:
|
||||
"operator<<( has_template_operator )"
|
||||
==
|
||||
"operator<<( has_template_operator )"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
stringify( vectors<has_maker> )
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -8959,6 +8992,6 @@ Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 205 | 139 passed | 62 failed | 4 failed as expected
|
||||
assertions: 1077 | 935 passed | 121 failed | 21 failed as expected
|
||||
test cases: 208 | 142 passed | 62 failed | 4 failed as expected
|
||||
assertions: 1079 | 937 passed | 121 failed | 21 failed as expected
|
||||
|
||||
|
@@ -126,6 +126,15 @@ with messages:
|
||||
uarr := "123"
|
||||
sarr := "456"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1245
|
||||
-------------------------------------------------------------------------------
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#748 - captures with unexpected exceptions
|
||||
outside assertions
|
||||
@@ -332,6 +341,6 @@ with expansion:
|
||||
!true
|
||||
|
||||
===============================================================================
|
||||
test cases: 13 | 10 passed | 1 failed | 2 failed as expected
|
||||
assertions: 37 | 30 passed | 4 failed | 3 failed as expected
|
||||
test cases: 14 | 11 passed | 1 failed | 2 failed as expected
|
||||
assertions: 38 | 31 passed | 4 failed | 3 failed as expected
|
||||
|
||||
|
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="17" failures="105" tests="1078" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="105" tests="1080" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#1027" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#1147" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#1175 - Hidden Test" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#1238" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.(Fixture_1245<int, int>)" name="#1245" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
|
||||
<error type="TEST_CASE">
|
||||
expected exception
|
||||
@@ -217,6 +218,7 @@ Matchers.tests.cpp:<line number>
|
||||
Matchers.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Exception matchers that fail/No exception" time="{duration}">
|
||||
<failure message="doesNotThrow(), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES">
|
||||
Matchers.tests.cpp:<line number>
|
||||
@@ -236,10 +238,10 @@ Matchers.tests.cpp:<line number>
|
||||
</error>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}">
|
||||
<failure message="{?} special exception has value of 1" type="CHECK_THROWS_MATCHES">
|
||||
<failure message="SpecialException::what special exception has value of 1" type="CHECK_THROWS_MATCHES">
|
||||
Matchers.tests.cpp:<line number>
|
||||
</failure>
|
||||
<failure message="{?} special exception has value of 1" type="REQUIRE_THROWS_MATCHES">
|
||||
<failure message="SpecialException::what special exception has value of 1" type="REQUIRE_THROWS_MATCHES">
|
||||
Matchers.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
@@ -474,8 +476,8 @@ Message.tests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using ~" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/console" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/xml" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r xml and junit" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/--reporter/junit" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Only one reporter is accepted" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/debugger/-b" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/debugger/--break" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-a aborts after first failure" time="{duration}"/>
|
||||
@@ -836,6 +838,7 @@ Tricky.tests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="stringify( has_maker_and_operator )" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="stringify( has_neither )" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="stringify( has_operator )" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="stringify( has_template_operator )" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="stringify( vectors<has_maker> )" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="stringify( vectors<has_maker_and_operator> )" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="stringify( vectors<has_operator> )" time="{duration}"/>
|
||||
|
@@ -127,6 +127,9 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#1245" tags="[compilation]" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
|
||||
<Section name="outside assertions" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
|
||||
<Info>
|
||||
@@ -1898,6 +1901,37 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" tags="[exception][toString]" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify(WhatException{}) == "This exception has overriden what() method"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"This exception has overriden what() method"
|
||||
==
|
||||
"This exception has overriden what() method"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify(OperatorException{}) == "OperatorException"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"OperatorException" == "OperatorException"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"StringMakerException"
|
||||
==
|
||||
"StringMakerException"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Exception matchers that fail" tags="[!throws][.][.failing][exceptions][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
<Section name="No exception" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
<Expression success="false" type="CHECK_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
@@ -1949,7 +1983,7 @@
|
||||
throws(3), SpecialException, ExceptionMatcher{1}
|
||||
</Original>
|
||||
<Expanded>
|
||||
{?} special exception has value of 1
|
||||
SpecialException::what special exception has value of 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
@@ -1957,7 +1991,7 @@
|
||||
throws(4), SpecialException, ExceptionMatcher{1}
|
||||
</Original>
|
||||
<Expanded>
|
||||
{?} special exception has value of 1
|
||||
SpecialException::what special exception has value of 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="0" failures="2" expectedFailures="0"/>
|
||||
@@ -1970,7 +2004,7 @@
|
||||
throws(1), SpecialException, ExceptionMatcher{1}
|
||||
</Original>
|
||||
<Expanded>
|
||||
{?} special exception has value of 1
|
||||
SpecialException::what special exception has value of 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
@@ -1978,7 +2012,7 @@
|
||||
throws(2), SpecialException, ExceptionMatcher{2}
|
||||
</Original>
|
||||
<Expanded>
|
||||
{?} special exception has value of 2
|
||||
SpecialException::what special exception has value of 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
@@ -4757,10 +4791,10 @@
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
config.reporterNames.empty()
|
||||
config.reporterName == "console"
|
||||
</Original>
|
||||
<Expanded>
|
||||
true
|
||||
"console" == "console"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
@@ -4899,7 +4933,7 @@
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
config.reporterNames[0] == "console"
|
||||
config.reporterName == "console"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"console" == "console"
|
||||
@@ -4921,7 +4955,7 @@
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
config.reporterNames[0] == "xml"
|
||||
config.reporterName == "xml"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"xml" == "xml"
|
||||
@@ -4931,44 +4965,6 @@
|
||||
</Section>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Section name="-r xml and junit" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
cli.parse({"test", "-r", "xml", "-r", "junit"})
|
||||
</Original>
|
||||
<Expanded>
|
||||
{?}
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
config.reporterNames.size() == 2
|
||||
</Original>
|
||||
<Expanded>
|
||||
2 == 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
config.reporterNames[0] == "xml"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"xml" == "xml"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
config.reporterNames[1] == "junit"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"junit" == "junit"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Section name="--reporter/junit" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
@@ -4981,7 +4977,7 @@
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
config.reporterNames[0] == "junit"
|
||||
config.reporterName == "junit"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"junit" == "junit"
|
||||
@@ -4991,6 +4987,20 @@
|
||||
</Section>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Section name="Only one reporter is accepted" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Original>
|
||||
!(cli.parse({ "test", "-r", "xml", "-r", "junit" }))
|
||||
</Original>
|
||||
<Expanded>
|
||||
!{?}
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Section name="debugger" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Section name="-b" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
@@ -9356,6 +9366,19 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="stringify( has_template_operator )" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"operator<<( has_template_operator )"
|
||||
==
|
||||
"operator<<( has_template_operator )"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="stringify( vectors<has_maker> )" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
|
||||
<Original>
|
||||
@@ -9913,7 +9936,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="935" failures="122" expectedFailures="21"/>
|
||||
<OverallResults successes="937" failures="122" expectedFailures="21"/>
|
||||
</Group>
|
||||
<OverallResults successes="935" failures="121" expectedFailures="21"/>
|
||||
<OverallResults successes="937" failures="121" expectedFailures="21"/>
|
||||
</Catch>
|
||||
|
@@ -288,7 +288,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
CHECK(config.shouldDebugBreak == false);
|
||||
CHECK(config.abortAfter == -1);
|
||||
CHECK(config.noThrow == false);
|
||||
CHECK(config.reporterNames.empty());
|
||||
CHECK(config.reporterName == "console");
|
||||
|
||||
Catch::Config cfg(config);
|
||||
CHECK_FALSE(cfg.hasTestFilters());
|
||||
@@ -330,24 +330,20 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
SECTION("-r/console") {
|
||||
CHECK(cli.parse({"test", "-r", "console"}));
|
||||
|
||||
REQUIRE(config.reporterNames[0] == "console");
|
||||
REQUIRE(config.reporterName == "console");
|
||||
}
|
||||
SECTION("-r/xml") {
|
||||
CHECK(cli.parse({"test", "-r", "xml"}));
|
||||
|
||||
REQUIRE(config.reporterNames[0] == "xml");
|
||||
}
|
||||
SECTION("-r xml and junit") {
|
||||
CHECK(cli.parse({"test", "-r", "xml", "-r", "junit"}));
|
||||
|
||||
REQUIRE(config.reporterNames.size() == 2);
|
||||
REQUIRE(config.reporterNames[0] == "xml");
|
||||
REQUIRE(config.reporterNames[1] == "junit");
|
||||
REQUIRE(config.reporterName == "xml");
|
||||
}
|
||||
SECTION("--reporter/junit") {
|
||||
CHECK(cli.parse({"test", "--reporter", "junit"}));
|
||||
|
||||
REQUIRE(config.reporterNames[0] == "junit");
|
||||
REQUIRE(config.reporterName == "junit");
|
||||
}
|
||||
SECTION("Only one reporter is accepted") {
|
||||
REQUIRE_FALSE(cli.parse({ "test", "-r", "xml", "-r", "junit" }));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -88,6 +88,9 @@ namespace { namespace CompilationTests {
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
template <typename, typename>
|
||||
struct Fixture_1245 {};
|
||||
|
||||
#endif
|
||||
|
||||
TEST_CASE("#809") {
|
||||
@@ -147,4 +150,8 @@ namespace { namespace CompilationTests {
|
||||
REQUIRE(std::memcmp(sarr, "456", sizeof(sarr)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD((Fixture_1245<int, int>), "#1245", "[compilation]") {
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
}} // namespace CompilationTests
|
||||
|
@@ -45,6 +45,10 @@ namespace { namespace MatchersTests {
|
||||
struct SpecialException : std::exception {
|
||||
SpecialException(int i_) : i(i_) {}
|
||||
|
||||
char const* what() const noexcept override {
|
||||
return "SpecialException::what";
|
||||
}
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
|
@@ -304,7 +304,7 @@ TEST_CASE( "toString on const wchar_t pointer returns the string contents", "[to
|
||||
}
|
||||
|
||||
TEST_CASE( "toString on wchar_t const pointer returns the string contents", "[toString]" ) {
|
||||
auto const s = const_cast<wchar_t* const>( L"wide load" );
|
||||
auto const s = const_cast<wchar_t*>( L"wide load" );
|
||||
std::string result = ::Catch::Detail::stringify( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
@@ -115,3 +115,46 @@ TEST_CASE("Static arrays are convertible to string", "[toString]") {
|
||||
REQUIRE(Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })");
|
||||
}
|
||||
}
|
||||
|
||||
struct WhatException : std::exception {
|
||||
char const* what() const noexcept override {
|
||||
return "This exception has overriden what() method";
|
||||
}
|
||||
~WhatException() override;
|
||||
};
|
||||
|
||||
struct OperatorException : std::exception {
|
||||
~OperatorException() override;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, OperatorException const&) {
|
||||
out << "OperatorException";
|
||||
return out;
|
||||
}
|
||||
|
||||
struct StringMakerException : std::exception {
|
||||
~StringMakerException() override;
|
||||
};
|
||||
|
||||
namespace Catch {
|
||||
template <>
|
||||
struct StringMaker<StringMakerException> {
|
||||
static std::string convert(StringMakerException const&) {
|
||||
return "StringMakerException";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Avoid -Wweak-tables
|
||||
WhatException::~WhatException() = default;
|
||||
OperatorException::~OperatorException() = default;
|
||||
StringMakerException::~StringMakerException() = default;
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified", "[toString][exception]") {
|
||||
REQUIRE(::Catch::Detail::stringify(WhatException{}) == "This exception has overriden what() method");
|
||||
REQUIRE(::Catch::Detail::stringify(OperatorException{}) == "OperatorException");
|
||||
REQUIRE(::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException");
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ struct has_operator { };
|
||||
struct has_maker {};
|
||||
struct has_maker_and_operator {};
|
||||
struct has_neither {};
|
||||
struct has_template_operator {};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const has_operator&) {
|
||||
os << "operator<<( has_operator )";
|
||||
@@ -31,6 +32,12 @@ std::ostream& operator<<(std::ostream& os, const has_maker_and_operator&) {
|
||||
return os;
|
||||
}
|
||||
|
||||
template <typename StreamT>
|
||||
StreamT& operator<<(StreamT& os, const has_template_operator&) {
|
||||
os << "operator<<( has_template_operator )";
|
||||
return os;
|
||||
}
|
||||
|
||||
namespace Catch {
|
||||
template<>
|
||||
struct StringMaker<has_maker> {
|
||||
@@ -69,6 +76,12 @@ TEST_CASE("stringify( has_neither )", "[toString]") {
|
||||
REQUIRE( ::Catch::Detail::stringify(item) == "{ !!! }" );
|
||||
}
|
||||
|
||||
// Call the templated operator
|
||||
TEST_CASE( "stringify( has_template_operator )", "[toString]" ) {
|
||||
has_template_operator item;
|
||||
REQUIRE( ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" );
|
||||
}
|
||||
|
||||
|
||||
// Vectors...
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
@@ -11,6 +12,10 @@ import difflib
|
||||
import scriptCommon
|
||||
from scriptCommon import catchPath
|
||||
|
||||
if os.name == 'nt':
|
||||
# Enable console colours on windows
|
||||
os.system('')
|
||||
|
||||
rootPath = os.path.join(catchPath, 'projects/SelfTest/Baselines')
|
||||
|
||||
|
||||
@@ -72,10 +77,11 @@ else:
|
||||
|
||||
overallResult = 0
|
||||
|
||||
|
||||
def diffFiles(fileA, fileB):
|
||||
with open(fileA, 'r') as file:
|
||||
with io.open(fileA, 'r', encoding='utf-8', errors='surrogateescape') as file:
|
||||
aLines = [line.rstrip() for line in file.readlines()]
|
||||
with open(fileB, 'r') as file:
|
||||
with io.open(fileB, 'r', encoding='utf-8', errors='surrogateescape') as file:
|
||||
bLines = [line.rstrip() for line in file.readlines()]
|
||||
|
||||
shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1]
|
||||
@@ -85,7 +91,7 @@ def diffFiles(fileA, fileB):
|
||||
return [line for line in diff if line[0] in ('+', '-')]
|
||||
|
||||
|
||||
def filterLine(line):
|
||||
def filterLine(line, isCompact):
|
||||
if catchPath in line:
|
||||
# make paths relative to Catch root
|
||||
line = line.replace(catchPath + os.sep, '')
|
||||
@@ -103,6 +109,10 @@ def filterLine(line):
|
||||
else:
|
||||
line = lineNumberParser.sub(" ", line)
|
||||
|
||||
if isCompact:
|
||||
line = line.replace(': FAILED', ': failed')
|
||||
line = line.replace(': PASSED', ': passed')
|
||||
|
||||
# strip Catch version number
|
||||
line = versionParser.sub("<version>", line)
|
||||
|
||||
@@ -139,10 +149,10 @@ def approve(baseName, args):
|
||||
subprocess.call(args, stdout=f, stderr=f)
|
||||
f.close()
|
||||
|
||||
rawFile = open(rawResultsPath, 'r')
|
||||
filteredFile = open(filteredResultsPath, 'w')
|
||||
rawFile = io.open(rawResultsPath, 'r', encoding='utf-8', errors='surrogateescape')
|
||||
filteredFile = io.open(filteredResultsPath, 'w', encoding='utf-8', errors='surrogateescape')
|
||||
for line in rawFile:
|
||||
filteredFile.write(filterLine(line).rstrip() + "\n")
|
||||
filteredFile.write(filterLine(line, 'compact' in baseName).rstrip() + "\n")
|
||||
filteredFile.close()
|
||||
rawFile.close()
|
||||
|
||||
|
@@ -11,23 +11,23 @@ from scriptCommon import catchPath
|
||||
rootPath = os.path.join( catchPath, 'projects/SelfTest/Baselines' )
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
files = [os.path.join( rootPath, f ) for f in sys.argv[1:]]
|
||||
files = [os.path.join( rootPath, f ) for f in sys.argv[1:]]
|
||||
else:
|
||||
files = glob.glob( os.path.join( rootPath, "*.unapproved.txt" ) )
|
||||
files = glob.glob( os.path.join( rootPath, "*.unapproved.txt" ) )
|
||||
|
||||
|
||||
def approveFile( approvedFile, unapprovedFile ):
|
||||
justFilename = unapprovedFile[len(rootPath)+1:]
|
||||
if os.path.exists( unapprovedFile ):
|
||||
if os.path.exists( approvedFile ):
|
||||
os.remove( approvedFile )
|
||||
os.rename( unapprovedFile, approvedFile )
|
||||
print( "approved " + justFilename )
|
||||
else:
|
||||
print( "approval file " + justFilename + " does not exist" )
|
||||
justFilename = unapprovedFile[len(rootPath)+1:]
|
||||
if os.path.exists( unapprovedFile ):
|
||||
if os.path.exists( approvedFile ):
|
||||
os.remove( approvedFile )
|
||||
os.rename( unapprovedFile, approvedFile )
|
||||
print( "approved " + justFilename )
|
||||
else:
|
||||
print( "approval file " + justFilename + " does not exist" )
|
||||
|
||||
if len(files) > 0:
|
||||
for unapprovedFile in files:
|
||||
approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile )
|
||||
if files:
|
||||
for unapprovedFile in files:
|
||||
approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile )
|
||||
else:
|
||||
print( "no files to approve" )
|
||||
print( "no files to approve" )
|
||||
|
@@ -25,7 +25,7 @@ class LineMapper:
|
||||
# TBD:
|
||||
# #if, #ifdef, comments after #else
|
||||
def mapLine( self, lineNo, line ):
|
||||
for idFrom, idTo in self.idMap.iteritems():
|
||||
for idFrom, idTo in self.idMap.items():
|
||||
r = re.compile("(.*)" + idFrom + "(.*)")
|
||||
|
||||
m = r.match( line )
|
||||
@@ -38,7 +38,7 @@ class LineMapper:
|
||||
# print("[{0}] originalNs: '{1}' - closing".format(lineNo, originalNs))
|
||||
# print( " " + line )
|
||||
# print( " 1:[{0}]\n 2:[{1}]\n 3:[{2}]\n 4:[{3}]\n 5:[{4}]".format( m.group(1), m.group(2), m.group(3), m.group(4), m.group(5) ) )
|
||||
if self.outerNamespace.has_key(originalNs):
|
||||
if originalNs in self.outerNamespace:
|
||||
outerNs, innerNs = self.outerNamespace[originalNs]
|
||||
return "{0}}}{1}{2}::{3}{4}{5}\n".format( m.group(1), m.group(2), outerNs, innerNs, m.group(4), m.group(5))
|
||||
m = nsRe.match( line )
|
||||
@@ -47,7 +47,7 @@ class LineMapper:
|
||||
# print("[{0}] originalNs: '{1}'".format(lineNo, originalNs))
|
||||
# print( " " + line )
|
||||
# print( " 1:[{0}]\n 2:[{1}]\n 3:[{2}]\n 4:[{3}]".format( m.group(1), m.group(2), m.group(3), m.group(4) ) )
|
||||
if self.outerNamespace.has_key(originalNs):
|
||||
if originalNs in self.outerNamespace:
|
||||
outerNs, innerNs = self.outerNamespace[originalNs]
|
||||
return "{0}{1} {{ namespace {2}{3}{4}\n".format( m.group(1), outerNs, innerNs, m.group(3), m.group(4) )
|
||||
|
||||
|
@@ -4,19 +4,20 @@ from __future__ import print_function
|
||||
import os
|
||||
from scriptCommon import catchPath
|
||||
|
||||
changedFiles = 0
|
||||
|
||||
def isSourceFile( path ):
|
||||
return path.endswith( ".cpp" ) or path.endswith( ".h" ) or path.endswith( ".hpp" )
|
||||
|
||||
def fixAllFilesInDir( dir ):
|
||||
changedFiles = 0
|
||||
for f in os.listdir( dir ):
|
||||
path = os.path.join( dir,f )
|
||||
if os.path.isfile( path ):
|
||||
if isSourceFile( path ):
|
||||
fixFile( path )
|
||||
if fixFile( path ):
|
||||
changedFiles += 1
|
||||
else:
|
||||
fixAllFilesInDir( path )
|
||||
return changedFiles
|
||||
|
||||
def fixFile( path ):
|
||||
f = open( path, 'r' )
|
||||
@@ -41,8 +42,10 @@ def fixFile( path ):
|
||||
f2.write( line )
|
||||
f2.close()
|
||||
os.remove( altPath )
|
||||
return True
|
||||
return False
|
||||
|
||||
fixAllFilesInDir(catchPath)
|
||||
changedFiles = fixAllFilesInDir(catchPath)
|
||||
if changedFiles > 0:
|
||||
print( "Fixed " + str(changedFiles) + " file(s)" )
|
||||
else:
|
||||
|
@@ -7,7 +7,6 @@ import io
|
||||
import sys
|
||||
import re
|
||||
import datetime
|
||||
import string
|
||||
from glob import glob
|
||||
|
||||
from scriptCommon import catchPath
|
||||
@@ -34,7 +33,7 @@ def generate(v):
|
||||
}
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
arg = string.lower(arg)
|
||||
arg = arg.lower()
|
||||
if arg == "noimpl":
|
||||
globals['includeImpl'] = False
|
||||
print( "Not including impl code" )
|
||||
@@ -51,7 +50,7 @@ def generate(v):
|
||||
|
||||
def write( line ):
|
||||
if globals['includeImpl'] or globals['implIfDefs'] == -1:
|
||||
out.write( line.decode('utf-8') )
|
||||
out.write( line )
|
||||
|
||||
def insertCpps():
|
||||
dirs = [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters']]
|
||||
@@ -65,9 +64,9 @@ def generate(v):
|
||||
parseFile(dir, name)
|
||||
|
||||
def parseFile( path, filename ):
|
||||
f = open( os.path.join(path, filename), 'r' )
|
||||
f = io.open( os.path.join(path, filename), 'r', encoding='utf-8' )
|
||||
blanks = 0
|
||||
write( "// start {0}\n".format( filename ) )
|
||||
write( u"// start {0}\n".format( filename ) )
|
||||
for line in f:
|
||||
if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line:
|
||||
insertCpps()
|
||||
@@ -82,7 +81,7 @@ def generate(v):
|
||||
if m:
|
||||
header = m.group(1)
|
||||
headerPath, sep, headerFile = header.rpartition( "/" )
|
||||
if not headerFile in seenHeaders:
|
||||
if headerFile not in seenHeaders:
|
||||
if headerFile != "tbc_text_format.h" and headerFile != "clara.h":
|
||||
seenHeaders.add( headerFile )
|
||||
if headerPath == "internal" and path.endswith("internal/"):
|
||||
@@ -102,25 +101,25 @@ def generate(v):
|
||||
blanks = 0
|
||||
if blanks < 2 and not defineParser.match(line):
|
||||
write( line.rstrip() + "\n" )
|
||||
write( '// end {}\n'.format(filename) )
|
||||
write( u'// end {}\n'.format(filename) )
|
||||
|
||||
|
||||
write( "/*\n" )
|
||||
write( " * Catch v{0}\n".format( v.getVersionString() ) )
|
||||
write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
|
||||
write( " * ----------------------------------------------------------\n" )
|
||||
write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
|
||||
write( " * Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".format( datetime.date.today().year ) )
|
||||
write( " *\n" )
|
||||
write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
|
||||
write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
|
||||
write( " */\n" )
|
||||
write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
|
||||
write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
|
||||
write( u"/*\n" )
|
||||
write( u" * Catch v{0}\n".format( v.getVersionString() ) )
|
||||
write( u" * Generated: {0}\n".format( datetime.datetime.now() ) )
|
||||
write( u" * ----------------------------------------------------------\n" )
|
||||
write( u" * This file has been merged from multiple headers. Please don't edit it directly\n" )
|
||||
write( u" * Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".format( datetime.date.today().year ) )
|
||||
write( u" *\n" )
|
||||
write( u" * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
|
||||
write( u" * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
|
||||
write( u" */\n" )
|
||||
write( u"#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
|
||||
write( u"#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
|
||||
|
||||
parseFile( rootPath, 'catch.hpp' )
|
||||
|
||||
write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
|
||||
write( u"#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
|
||||
out.close()
|
||||
print ("Generated single include for Catch v{0}\n".format( v.getVersionString() ) )
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import re
|
||||
import urllib2
|
||||
@@ -41,7 +43,6 @@ for line in lines:
|
||||
pass
|
||||
elif line.startswith( "Date:"):
|
||||
dates.append( line[5:].lstrip() )
|
||||
pass
|
||||
elif line == "" and prevLine == "":
|
||||
pass
|
||||
else:
|
||||
@@ -58,7 +59,7 @@ for line in lines:
|
||||
else:
|
||||
messages.append( line2 )
|
||||
|
||||
print "All changes between {0} and {1}:\n".format( dates[-1], dates[0] )
|
||||
print("All changes between {0} and {1}:\n".format( dates[-1], dates[0] ))
|
||||
|
||||
for line in messages:
|
||||
print line
|
||||
print(line)
|
||||
|
@@ -15,7 +15,7 @@ def runAndCapture( args ):
|
||||
line = ""
|
||||
while True:
|
||||
out = child.stdout.read(1)
|
||||
if out == '' and child.poll() != None:
|
||||
if out == '' and child.poll():
|
||||
break
|
||||
if out != '':
|
||||
if out == '\n':
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
from scriptCommon import catchPath
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
@@ -20,6 +19,8 @@ import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
from scriptCommon import catchPath
|
||||
|
||||
# Configuration:
|
||||
|
||||
minTocEntries = 4
|
||||
@@ -431,7 +432,7 @@ def updateDocumentToCMain():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
paths = args.Input if len(args.Input) > 0 else [documentsDefault]
|
||||
paths = args.Input if args.Input else [documentsDefault]
|
||||
|
||||
changedFiles = updateDocumentToC(paths=paths, min_toc_len=args.minTocEntries, verbose=args.verbose)
|
||||
|
||||
|
@@ -31,7 +31,6 @@ def get_hash(path):
|
||||
|
||||
def update_control(path):
|
||||
v = Version()
|
||||
ver_string = v.getVersionString()
|
||||
|
||||
# Update control
|
||||
lines = []
|
||||
@@ -48,7 +47,6 @@ def update_control(path):
|
||||
def update_portfile(path, header_hash, licence_hash):
|
||||
print('Updating portfile')
|
||||
v = Version()
|
||||
ver_string = v.getVersionString()
|
||||
|
||||
# Update portfile
|
||||
lines = []
|
||||
|
@@ -41,7 +41,7 @@ def uploadFiles():
|
||||
'save': True
|
||||
})
|
||||
|
||||
if 'status' in response and not 'compiler_error' in response:
|
||||
if 'status' in response and 'compiler_error' not in response:
|
||||
return True, response['url']
|
||||
else:
|
||||
return False, response
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Catch v2.2.2
|
||||
* Generated: 2018-04-06 12:05:03.186665
|
||||
* Catch v2.2.3
|
||||
* Generated: 2018-06-06 23:11:57.601416
|
||||
* ----------------------------------------------------------
|
||||
* This file has been merged from multiple headers. Please don't edit it directly
|
||||
* Copyright (c) 2018 Two Blue Cubes Ltd. All rights reserved.
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#define CATCH_VERSION_MAJOR 2
|
||||
#define CATCH_VERSION_MINOR 2
|
||||
#define CATCH_VERSION_PATCH 2
|
||||
#define CATCH_VERSION_PATCH 3
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang system_header
|
||||
@@ -72,7 +72,7 @@
|
||||
#elif defined(linux) || defined(__linux) || defined(__linux__)
|
||||
# define CATCH_PLATFORM_LINUX
|
||||
|
||||
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
|
||||
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
|
||||
# define CATCH_PLATFORM_WINDOWS
|
||||
#endif
|
||||
|
||||
@@ -164,6 +164,18 @@ namespace Catch {
|
||||
# define CATCH_CONFIG_COLOUR_NONE
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Android somehow still does not support std::to_string
|
||||
#if defined(__ANDROID__)
|
||||
# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Not all Windows environments support SEH properly
|
||||
#if defined(__MINGW32__)
|
||||
# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Cygwin
|
||||
#ifdef __CYGWIN__
|
||||
@@ -213,7 +225,7 @@ namespace Catch {
|
||||
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
|
||||
# define CATCH_CONFIG_COUNTER
|
||||
#endif
|
||||
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)
|
||||
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)
|
||||
# define CATCH_CONFIG_WINDOWS_SEH
|
||||
#endif
|
||||
// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
|
||||
@@ -225,6 +237,10 @@ namespace Catch {
|
||||
# define CATCH_CONFIG_WCHAR
|
||||
#endif
|
||||
|
||||
#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING)
|
||||
# define CATCH_CONFIG_CPP11_TO_STRING
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||
# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||
#endif
|
||||
@@ -513,12 +529,17 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
|
||||
#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
|
||||
#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
|
||||
#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
|
||||
|
||||
#if defined(CATCH_CONFIG_DISABLE)
|
||||
#define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
|
||||
namespace{ \
|
||||
struct TestName : ClassName { \
|
||||
struct TestName : INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF ClassName) { \
|
||||
void test(); \
|
||||
}; \
|
||||
} \
|
||||
@@ -546,7 +567,7 @@ struct AutoReg : NonCopyable {
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
namespace{ \
|
||||
struct TestName : ClassName{ \
|
||||
struct TestName : INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF ClassName) { \
|
||||
void test(); \
|
||||
}; \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
@@ -770,16 +791,22 @@ namespace Catch {
|
||||
std::string convertUnknownEnumToString( E e );
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<!std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) {
|
||||
#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
|
||||
(void)value;
|
||||
typename std::enable_if<
|
||||
!std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value,
|
||||
std::string>::type convertUnstreamable( T const& ) {
|
||||
return Detail::unprintableString;
|
||||
#else
|
||||
return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);
|
||||
#endif
|
||||
}
|
||||
template<typename T>
|
||||
typename std::enable_if<std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) {
|
||||
typename std::enable_if<
|
||||
!std::is_enum<T>::value && std::is_base_of<std::exception, T>::value,
|
||||
std::string>::type convertUnstreamable(T const& ex) {
|
||||
return ex.what();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_enum<T>::value
|
||||
, std::string>::type convertUnstreamable( T const& value ) {
|
||||
return convertUnknownEnumToString( value );
|
||||
}
|
||||
|
||||
@@ -805,7 +832,9 @@ namespace Catch {
|
||||
typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
|
||||
convert(const Fake& value) {
|
||||
ReusableStringStream rss;
|
||||
rss << value;
|
||||
// NB: call using the function-like syntax to avoid ambiguity with
|
||||
// user-defined templated operator<< under clang.
|
||||
rss.operator<<(value);
|
||||
return rss.str();
|
||||
}
|
||||
|
||||
@@ -813,7 +842,11 @@ namespace Catch {
|
||||
static
|
||||
typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
|
||||
convert( const Fake& value ) {
|
||||
return Detail::convertUnstreamable( value );
|
||||
#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
|
||||
return Detail::convertUnstreamable(value);
|
||||
#else
|
||||
return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3354,8 +3387,12 @@ namespace Catch {
|
||||
std::string outputFilename;
|
||||
std::string name;
|
||||
std::string processName;
|
||||
#ifndef CATCH_CONFIG_DEFAULT_REPORTER
|
||||
#define CATCH_CONFIG_DEFAULT_REPORTER "console"
|
||||
#endif
|
||||
std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER;
|
||||
#undef CATCH_CONFIG_DEFAULT_REPORTER
|
||||
|
||||
std::vector<std::string> reporterNames;
|
||||
std::vector<std::string> testsOrTags;
|
||||
std::vector<std::string> sectionsToRun;
|
||||
};
|
||||
@@ -3375,8 +3412,8 @@ namespace Catch {
|
||||
bool listReporters() const;
|
||||
|
||||
std::string getProcessName() const;
|
||||
std::string const& getReporterName() const;
|
||||
|
||||
std::vector<std::string> const& getReporterNames() const;
|
||||
std::vector<std::string> const& getTestsOrTags() const;
|
||||
std::vector<std::string> const& getSectionsToRun() const override;
|
||||
|
||||
@@ -3733,8 +3770,6 @@ namespace Catch {
|
||||
virtual Listeners const& getListeners() const = 0;
|
||||
};
|
||||
|
||||
void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter );
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
// end catch_interfaces_reporter.h
|
||||
@@ -3742,7 +3777,7 @@ namespace Catch {
|
||||
#include <cstring>
|
||||
#include <cfloat>
|
||||
#include <cstdio>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
|
||||
@@ -6592,7 +6627,7 @@ namespace Catch {
|
||||
| Opt( config.outputFilename, "filename" )
|
||||
["-o"]["--out"]
|
||||
( "output filename" )
|
||||
| Opt( config.reporterNames, "name" )
|
||||
| Opt( config.reporterName, "name" )
|
||||
["-r"]["--reporter"]
|
||||
( "reporter to use (defaults to console)" )
|
||||
| Opt( config.name, "name" )
|
||||
@@ -6734,8 +6769,8 @@ namespace Catch {
|
||||
bool Config::listReporters() const { return m_data.listReporters; }
|
||||
|
||||
std::string Config::getProcessName() const { return m_data.processName; }
|
||||
std::string const& Config::getReporterName() const { return m_data.reporterName; }
|
||||
|
||||
std::vector<std::string> const& Config::getReporterNames() const { return m_data.reporterNames; }
|
||||
std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }
|
||||
std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }
|
||||
|
||||
@@ -7381,6 +7416,11 @@ namespace Catch {
|
||||
int id;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
// 32kb for the alternate stack seems to be sufficient. However, this value
|
||||
// is experimentally determined, so that's not guaranteed.
|
||||
constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
|
||||
|
||||
static SignalDefs signalDefs[] = {
|
||||
{ SIGINT, "SIGINT - Terminal interrupt signal" },
|
||||
{ SIGILL, "SIGILL - Illegal instruction signal" },
|
||||
@@ -7407,7 +7447,7 @@ namespace Catch {
|
||||
isSet = true;
|
||||
stack_t sigStack;
|
||||
sigStack.ss_sp = altStackMem;
|
||||
sigStack.ss_size = SIGSTKSZ;
|
||||
sigStack.ss_size = sigStackSize;
|
||||
sigStack.ss_flags = 0;
|
||||
sigaltstack(&sigStack, &oldSigStack);
|
||||
struct sigaction sa = { };
|
||||
@@ -7438,7 +7478,7 @@ namespace Catch {
|
||||
bool FatalConditionHandler::isSet = false;
|
||||
struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
|
||||
stack_t FatalConditionHandler::oldSigStack = {};
|
||||
char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
|
||||
char FatalConditionHandler::altStackMem[sigStackSize] = {};
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
@@ -7482,16 +7522,18 @@ namespace Catch {
|
||||
// end catch_interfaces_registry_hub.cpp
|
||||
// start catch_interfaces_reporter.cpp
|
||||
|
||||
// start catch_reporter_multi.h
|
||||
// start catch_reporter_listening.h
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class MultipleReporters : public IStreamingReporter {
|
||||
class ListeningReporter : public IStreamingReporter {
|
||||
using Reporters = std::vector<IStreamingReporterPtr>;
|
||||
Reporters m_reporters;
|
||||
Reporters m_listeners;
|
||||
IStreamingReporterPtr m_reporter = nullptr;
|
||||
|
||||
public:
|
||||
void add( IStreamingReporterPtr&& reporter );
|
||||
void addListener( IStreamingReporterPtr&& listener );
|
||||
void addReporter( IStreamingReporterPtr&& reporter );
|
||||
|
||||
public: // IStreamingReporter
|
||||
|
||||
@@ -7524,7 +7566,7 @@ namespace Catch {
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
// end catch_reporter_multi.h
|
||||
// end catch_reporter_listening.h
|
||||
namespace Catch {
|
||||
|
||||
ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig )
|
||||
@@ -7625,27 +7667,6 @@ namespace Catch {
|
||||
IReporterFactory::~IReporterFactory() = default;
|
||||
IReporterRegistry::~IReporterRegistry() = default;
|
||||
|
||||
void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) {
|
||||
|
||||
if( !existingReporter ) {
|
||||
existingReporter = std::move( additionalReporter );
|
||||
return;
|
||||
}
|
||||
|
||||
MultipleReporters* multi = nullptr;
|
||||
|
||||
if( existingReporter->isMulti() ) {
|
||||
multi = static_cast<MultipleReporters*>( existingReporter.get() );
|
||||
}
|
||||
else {
|
||||
auto newMulti = std::unique_ptr<MultipleReporters>( new MultipleReporters );
|
||||
newMulti->add( std::move( existingReporter ) );
|
||||
multi = newMulti.get();
|
||||
existingReporter = std::move( newMulti );
|
||||
}
|
||||
multi->add( std::move( additionalReporter ) );
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
// end catch_interfaces_reporter.cpp
|
||||
// start catch_interfaces_runner.cpp
|
||||
@@ -7887,6 +7908,24 @@ using Matchers::Impl::MatcherBase;
|
||||
// end catch_matchers.cpp
|
||||
// start catch_matchers_floating.cpp
|
||||
|
||||
// start catch_to_string.hpp
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Catch {
|
||||
template <typename T>
|
||||
std::string to_string(T const& t) {
|
||||
#if defined(CATCH_CONFIG_CPP11_TO_STRING)
|
||||
return std::to_string(t);
|
||||
#else
|
||||
ReusableStringStream rss;
|
||||
rss << t;
|
||||
return rss.str();
|
||||
#endif
|
||||
}
|
||||
} // end namespace Catch
|
||||
|
||||
// end catch_to_string.hpp
|
||||
#include <cstdlib>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
@@ -7992,7 +8031,7 @@ namespace Floating {
|
||||
}
|
||||
|
||||
std::string WithinUlpsMatcher::describe() const {
|
||||
return "is within " + std::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
|
||||
return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
|
||||
}
|
||||
|
||||
}// namespace Floating
|
||||
@@ -8179,6 +8218,213 @@ namespace Catch {
|
||||
}
|
||||
} // end namespace Catch
|
||||
// end catch_message.cpp
|
||||
// start catch_output_redirect.cpp
|
||||
|
||||
// start catch_output_redirect.h
|
||||
#ifndef TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
|
||||
#define TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class RedirectedStream {
|
||||
std::ostream& m_originalStream;
|
||||
std::ostream& m_redirectionStream;
|
||||
std::streambuf* m_prevBuf;
|
||||
|
||||
public:
|
||||
RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream );
|
||||
~RedirectedStream();
|
||||
};
|
||||
|
||||
class RedirectedStdOut {
|
||||
ReusableStringStream m_rss;
|
||||
RedirectedStream m_cout;
|
||||
public:
|
||||
RedirectedStdOut();
|
||||
auto str() const -> std::string;
|
||||
};
|
||||
|
||||
// StdErr has two constituent streams in C++, std::cerr and std::clog
|
||||
// This means that we need to redirect 2 streams into 1 to keep proper
|
||||
// order of writes
|
||||
class RedirectedStdErr {
|
||||
ReusableStringStream m_rss;
|
||||
RedirectedStream m_cerr;
|
||||
RedirectedStream m_clog;
|
||||
public:
|
||||
RedirectedStdErr();
|
||||
auto str() const -> std::string;
|
||||
};
|
||||
|
||||
// Windows's implementation of std::tmpfile is terrible (it tries
|
||||
// to create a file inside system folder, thus requiring elevated
|
||||
// privileges for the binary), so we have to use tmpnam(_s) and
|
||||
// create the file ourselves there.
|
||||
class TempFile {
|
||||
public:
|
||||
TempFile(TempFile const&) = delete;
|
||||
TempFile& operator=(TempFile const&) = delete;
|
||||
TempFile(TempFile&&) = delete;
|
||||
TempFile& operator=(TempFile&&) = delete;
|
||||
|
||||
TempFile();
|
||||
~TempFile();
|
||||
|
||||
std::FILE* getFile();
|
||||
std::string getContents();
|
||||
|
||||
private:
|
||||
std::FILE* m_file = nullptr;
|
||||
#if defined(_MSC_VER)
|
||||
char m_buffer[L_tmpnam] = { 0 };
|
||||
#endif
|
||||
};
|
||||
|
||||
class OutputRedirect {
|
||||
public:
|
||||
OutputRedirect(OutputRedirect const&) = delete;
|
||||
OutputRedirect& operator=(OutputRedirect const&) = delete;
|
||||
OutputRedirect(OutputRedirect&&) = delete;
|
||||
OutputRedirect& operator=(OutputRedirect&&) = delete;
|
||||
|
||||
OutputRedirect(std::string& stdout_dest, std::string& stderr_dest);
|
||||
~OutputRedirect();
|
||||
|
||||
private:
|
||||
int m_originalStdout = -1;
|
||||
int m_originalStderr = -1;
|
||||
TempFile m_stdoutFile;
|
||||
TempFile m_stderrFile;
|
||||
std::string& m_stdoutDest;
|
||||
std::string& m_stderrDest;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
|
||||
// end catch_output_redirect.h
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <io.h> //_dup and _dup2
|
||||
#define dup _dup
|
||||
#define dup2 _dup2
|
||||
#define fileno _fileno
|
||||
#else
|
||||
#include <unistd.h> // dup and dup2
|
||||
#endif
|
||||
|
||||
namespace Catch {
|
||||
|
||||
RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )
|
||||
: m_originalStream( originalStream ),
|
||||
m_redirectionStream( redirectionStream ),
|
||||
m_prevBuf( m_originalStream.rdbuf() )
|
||||
{
|
||||
m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
|
||||
}
|
||||
|
||||
RedirectedStream::~RedirectedStream() {
|
||||
m_originalStream.rdbuf( m_prevBuf );
|
||||
}
|
||||
|
||||
RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}
|
||||
auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); }
|
||||
|
||||
RedirectedStdErr::RedirectedStdErr()
|
||||
: m_cerr( Catch::cerr(), m_rss.get() ),
|
||||
m_clog( Catch::clog(), m_rss.get() )
|
||||
{}
|
||||
auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); }
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
TempFile::TempFile() {
|
||||
if (tmpnam_s(m_buffer)) {
|
||||
throw std::runtime_error("Could not get a temp filename");
|
||||
}
|
||||
if (fopen_s(&m_file, m_buffer, "w")) {
|
||||
char buffer[100];
|
||||
if (strerror_s(buffer, errno)) {
|
||||
throw std::runtime_error("Could not translate errno to string");
|
||||
}
|
||||
throw std::runtime_error("Could not open the temp file: " + std::string(m_buffer) + buffer);
|
||||
}
|
||||
}
|
||||
#else
|
||||
TempFile::TempFile() {
|
||||
m_file = std::tmpfile();
|
||||
if (!m_file) {
|
||||
throw std::runtime_error("Could not create a temp file.");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TempFile::~TempFile() {
|
||||
// TBD: What to do about errors here?
|
||||
std::fclose(m_file);
|
||||
// We manually create the file on Windows only, on Linux
|
||||
// it will be autodeleted
|
||||
#if defined(_MSC_VER)
|
||||
std::remove(m_buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
FILE* TempFile::getFile() {
|
||||
return m_file;
|
||||
}
|
||||
|
||||
std::string TempFile::getContents() {
|
||||
std::stringstream sstr;
|
||||
char buffer[100] = {};
|
||||
std::rewind(m_file);
|
||||
while (std::fgets(buffer, sizeof(buffer), m_file)) {
|
||||
sstr << buffer;
|
||||
}
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) :
|
||||
m_originalStdout(dup(1)),
|
||||
m_originalStderr(dup(2)),
|
||||
m_stdoutDest(stdout_dest),
|
||||
m_stderrDest(stderr_dest) {
|
||||
dup2(fileno(m_stdoutFile.getFile()), 1);
|
||||
dup2(fileno(m_stderrFile.getFile()), 2);
|
||||
}
|
||||
|
||||
OutputRedirect::~OutputRedirect() {
|
||||
Catch::cout() << std::flush;
|
||||
fflush(stdout);
|
||||
// Since we support overriding these streams, we flush cerr
|
||||
// even though std::cerr is unbuffered
|
||||
Catch::cerr() << std::flush;
|
||||
Catch::clog() << std::flush;
|
||||
fflush(stderr);
|
||||
|
||||
dup2(m_originalStdout, 1);
|
||||
dup2(m_originalStderr, 2);
|
||||
|
||||
m_stdoutDest += m_stdoutFile.getContents();
|
||||
m_stderrDest += m_stderrFile.getContents();
|
||||
}
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#undef dup
|
||||
#undef dup2
|
||||
#undef fileno
|
||||
#endif
|
||||
// end catch_output_redirect.cpp
|
||||
// start catch_random_number_generator.cpp
|
||||
|
||||
// start catch_random_number_generator.h
|
||||
@@ -8507,47 +8753,6 @@ namespace Catch {
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class RedirectedStream {
|
||||
std::ostream& m_originalStream;
|
||||
std::ostream& m_redirectionStream;
|
||||
std::streambuf* m_prevBuf;
|
||||
|
||||
public:
|
||||
RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )
|
||||
: m_originalStream( originalStream ),
|
||||
m_redirectionStream( redirectionStream ),
|
||||
m_prevBuf( m_originalStream.rdbuf() )
|
||||
{
|
||||
m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
|
||||
}
|
||||
~RedirectedStream() {
|
||||
m_originalStream.rdbuf( m_prevBuf );
|
||||
}
|
||||
};
|
||||
|
||||
class RedirectedStdOut {
|
||||
ReusableStringStream m_rss;
|
||||
RedirectedStream m_cout;
|
||||
public:
|
||||
RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}
|
||||
auto str() const -> std::string { return m_rss.str(); }
|
||||
};
|
||||
|
||||
// StdErr has two constituent streams in C++, std::cerr and std::clog
|
||||
// This means that we need to redirect 2 streams into 1 to keep proper
|
||||
// order of writes
|
||||
class RedirectedStdErr {
|
||||
ReusableStringStream m_rss;
|
||||
RedirectedStream m_cerr;
|
||||
RedirectedStream m_clog;
|
||||
public:
|
||||
RedirectedStdErr()
|
||||
: m_cerr( Catch::cerr(), m_rss.get() ),
|
||||
m_clog( Catch::clog(), m_rss.get() )
|
||||
{}
|
||||
auto str() const -> std::string { return m_rss.str(); }
|
||||
};
|
||||
|
||||
RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)
|
||||
: m_runInfo(_config->name()),
|
||||
m_context(getCurrentMutableContext()),
|
||||
@@ -8794,13 +8999,19 @@ namespace Catch {
|
||||
Timer timer;
|
||||
try {
|
||||
if (m_reporter->getPreferences().shouldRedirectStdOut) {
|
||||
#if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
|
||||
RedirectedStdOut redirectedStdOut;
|
||||
RedirectedStdErr redirectedStdErr;
|
||||
|
||||
timer.start();
|
||||
invokeActiveTestCase();
|
||||
redirectedCout += redirectedStdOut.str();
|
||||
redirectedCerr += redirectedStdErr.str();
|
||||
|
||||
#else
|
||||
OutputRedirect r(redirectedCout, redirectedCerr);
|
||||
timer.start();
|
||||
invokeActiveTestCase();
|
||||
#endif
|
||||
} else {
|
||||
timer.start();
|
||||
invokeActiveTestCase();
|
||||
@@ -9094,32 +9305,25 @@ namespace Catch {
|
||||
return reporter;
|
||||
}
|
||||
|
||||
#ifndef CATCH_CONFIG_DEFAULT_REPORTER
|
||||
#define CATCH_CONFIG_DEFAULT_REPORTER "console"
|
||||
#endif
|
||||
|
||||
IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {
|
||||
auto const& reporterNames = config->getReporterNames();
|
||||
if (reporterNames.empty())
|
||||
return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config);
|
||||
if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) {
|
||||
return createReporter(config->getReporterName(), config);
|
||||
}
|
||||
|
||||
IStreamingReporterPtr reporter;
|
||||
for (auto const& name : reporterNames)
|
||||
addReporter(reporter, createReporter(name, config));
|
||||
return reporter;
|
||||
}
|
||||
auto multi = std::unique_ptr<ListeningReporter>(new ListeningReporter);
|
||||
|
||||
#undef CATCH_CONFIG_DEFAULT_REPORTER
|
||||
|
||||
void addListeners(IStreamingReporterPtr& reporters, IConfigPtr const& config) {
|
||||
auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
|
||||
for (auto const& listener : listeners)
|
||||
addReporter(reporters, listener->create(Catch::ReporterConfig(config)));
|
||||
for (auto const& listener : listeners) {
|
||||
multi->addListener(listener->create(Catch::ReporterConfig(config)));
|
||||
}
|
||||
multi->addReporter(createReporter(config->getReporterName(), config));
|
||||
return std::move(multi);
|
||||
}
|
||||
|
||||
Catch::Totals runTests(std::shared_ptr<Config> const& config) {
|
||||
IStreamingReporterPtr reporter = makeReporter(config);
|
||||
addListeners(reporter, config);
|
||||
// FixMe: Add listeners in order first, then add reporters.
|
||||
|
||||
auto reporter = makeReporter(config);
|
||||
|
||||
RunContext context(config, std::move(reporter));
|
||||
|
||||
@@ -9847,7 +10051,7 @@ namespace Catch {
|
||||
return TestCaseInfo::None;
|
||||
}
|
||||
bool isReservedTag( std::string const& tag ) {
|
||||
return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] );
|
||||
return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast<unsigned char>(tag[0]) );
|
||||
}
|
||||
void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
||||
CATCH_ENFORCE( !isReservedTag(tag),
|
||||
@@ -10085,7 +10289,7 @@ namespace Catch {
|
||||
// start catch_test_case_tracker.cpp
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
@@ -10913,7 +11117,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 2, 2, 2, "", 0 );
|
||||
static Version version( 2, 2, 3, "", 0 );
|
||||
return version;
|
||||
}
|
||||
|
||||
@@ -11240,7 +11444,7 @@ namespace {
|
||||
#include <cstring>
|
||||
#include <cfloat>
|
||||
#include <cstdio>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
||||
namespace Catch {
|
||||
@@ -12183,7 +12387,7 @@ CATCH_REGISTER_REPORTER("console", ConsoleReporter)
|
||||
// end catch_reporter_console.cpp
|
||||
// start catch_reporter_junit.cpp
|
||||
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
@@ -12416,100 +12620,133 @@ namespace Catch {
|
||||
|
||||
} // end namespace Catch
|
||||
// end catch_reporter_junit.cpp
|
||||
// start catch_reporter_multi.cpp
|
||||
// start catch_reporter_listening.cpp
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
void MultipleReporters::add( IStreamingReporterPtr&& reporter ) {
|
||||
m_reporters.push_back( std::move( reporter ) );
|
||||
void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) {
|
||||
m_listeners.push_back( std::move( listener ) );
|
||||
}
|
||||
|
||||
ReporterPreferences MultipleReporters::getPreferences() const {
|
||||
return m_reporters[0]->getPreferences();
|
||||
void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) {
|
||||
assert(!m_reporter && "Listening reporter can wrap only 1 real reporter");
|
||||
m_reporter = std::move( reporter );
|
||||
}
|
||||
|
||||
std::set<Verbosity> MultipleReporters::getSupportedVerbosities() {
|
||||
ReporterPreferences ListeningReporter::getPreferences() const {
|
||||
return m_reporter->getPreferences();
|
||||
}
|
||||
|
||||
std::set<Verbosity> ListeningReporter::getSupportedVerbosities() {
|
||||
return std::set<Verbosity>{ };
|
||||
}
|
||||
|
||||
void MultipleReporters::noMatchingTestCases( std::string const& spec ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->noMatchingTestCases( spec );
|
||||
void ListeningReporter::noMatchingTestCases( std::string const& spec ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->noMatchingTestCases( spec );
|
||||
}
|
||||
m_reporter->noMatchingTestCases( spec );
|
||||
}
|
||||
|
||||
void MultipleReporters::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->benchmarkStarting( benchmarkInfo );
|
||||
void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->benchmarkStarting( benchmarkInfo );
|
||||
}
|
||||
m_reporter->benchmarkStarting( benchmarkInfo );
|
||||
}
|
||||
void MultipleReporters::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->benchmarkEnded( benchmarkStats );
|
||||
void ListeningReporter::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->benchmarkEnded( benchmarkStats );
|
||||
}
|
||||
m_reporter->benchmarkEnded( benchmarkStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testRunStarting( testRunInfo );
|
||||
void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testRunStarting( testRunInfo );
|
||||
}
|
||||
m_reporter->testRunStarting( testRunInfo );
|
||||
}
|
||||
|
||||
void MultipleReporters::testGroupStarting( GroupInfo const& groupInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testGroupStarting( groupInfo );
|
||||
void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testGroupStarting( groupInfo );
|
||||
}
|
||||
m_reporter->testGroupStarting( groupInfo );
|
||||
}
|
||||
|
||||
void MultipleReporters::testCaseStarting( TestCaseInfo const& testInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testCaseStarting( testInfo );
|
||||
void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testCaseStarting( testInfo );
|
||||
}
|
||||
m_reporter->testCaseStarting( testInfo );
|
||||
}
|
||||
|
||||
void MultipleReporters::sectionStarting( SectionInfo const& sectionInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->sectionStarting( sectionInfo );
|
||||
void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->sectionStarting( sectionInfo );
|
||||
}
|
||||
m_reporter->sectionStarting( sectionInfo );
|
||||
}
|
||||
|
||||
void MultipleReporters::assertionStarting( AssertionInfo const& assertionInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->assertionStarting( assertionInfo );
|
||||
void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->assertionStarting( assertionInfo );
|
||||
}
|
||||
m_reporter->assertionStarting( assertionInfo );
|
||||
}
|
||||
|
||||
// The return value indicates if the messages buffer should be cleared:
|
||||
bool MultipleReporters::assertionEnded( AssertionStats const& assertionStats ) {
|
||||
bool clearBuffer = false;
|
||||
for( auto const& reporter : m_reporters )
|
||||
clearBuffer |= reporter->assertionEnded( assertionStats );
|
||||
return clearBuffer;
|
||||
bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) {
|
||||
for( auto const& listener : m_listeners ) {
|
||||
static_cast<void>( listener->assertionEnded( assertionStats ) );
|
||||
}
|
||||
return m_reporter->assertionEnded( assertionStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::sectionEnded( SectionStats const& sectionStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->sectionEnded( sectionStats );
|
||||
void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->sectionEnded( sectionStats );
|
||||
}
|
||||
m_reporter->sectionEnded( sectionStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testCaseEnded( testCaseStats );
|
||||
void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testCaseEnded( testCaseStats );
|
||||
}
|
||||
m_reporter->testCaseEnded( testCaseStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::testGroupEnded( TestGroupStats const& testGroupStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testGroupEnded( testGroupStats );
|
||||
void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testGroupEnded( testGroupStats );
|
||||
}
|
||||
m_reporter->testGroupEnded( testGroupStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::testRunEnded( TestRunStats const& testRunStats ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->testRunEnded( testRunStats );
|
||||
void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->testRunEnded( testRunStats );
|
||||
}
|
||||
m_reporter->testRunEnded( testRunStats );
|
||||
}
|
||||
|
||||
void MultipleReporters::skipTest( TestCaseInfo const& testInfo ) {
|
||||
for( auto const& reporter : m_reporters )
|
||||
reporter->skipTest( testInfo );
|
||||
void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) {
|
||||
for ( auto const& listener : m_listeners ) {
|
||||
listener->skipTest( testInfo );
|
||||
}
|
||||
m_reporter->skipTest( testInfo );
|
||||
}
|
||||
|
||||
bool MultipleReporters::isMulti() const {
|
||||
bool ListeningReporter::isMulti() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
// end catch_reporter_multi.cpp
|
||||
// end catch_reporter_listening.cpp
|
||||
// start catch_reporter_xml.cpp
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
@@ -10,7 +10,7 @@ class CatchConanTest(ConanFile):
|
||||
settings = "os", "compiler", "arch", "build_type"
|
||||
username = getenv("CONAN_USERNAME", "philsquared")
|
||||
channel = getenv("CONAN_CHANNEL", "testing")
|
||||
requires = "Catch/2.2.2@%s/%s" % (username, channel)
|
||||
requires = "Catch/2.2.3@%s/%s" % (username, channel)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
|
Reference in New Issue
Block a user