Commit Graph

275 Commits

Author SHA1 Message Date
Martin Hořeňovský 166c520598
Remove another unused member variable from CumulativeReporterBase 2020-11-14 16:17:48 +01:00
Martin Hořeňovský a29deeb129
Remove unused member in StreamingReporterBase
Part of #2089
2020-11-14 16:17:39 +01:00
Martin Hořeňovský 1cef51b69b
Default StreamingReporterBase::Node destructor 2020-11-14 16:17:35 +01:00
Martin Hořeňovský 79c1bf9301
Use plain pointer to point to deepest section in CumulativeReporterBase
Part of #2089
2020-11-14 16:17:27 +01:00
Martin Hořeňovský 4f14922aa3
Don't use shared_ptr to store test run info in CumulativeReporterBase
Part of #2089
2020-11-14 16:16:28 +01:00
Martin Hořeňovský 135103bacf
Arg::parse accepts plain Args as argument 2020-11-07 18:00:27 +01:00
Martin Hořeňovský f97436a1f7
Normalize include guard in catch_config_ucnaught_exceptions.hpp 2020-11-06 18:01:27 +01:00
Morwenn dd5652933a Silence -Wuseless-cast warning with GCC10
With GCC 10, the `static_cast<bool>` triggers the -Wuseless-cast warning. This commit changes the cast into `static_cast<const bool&>`: it achieves the same thing but doesn't trigger the warning thanks to the "gratuitous" type conversion to `const bool&`. As per references rules, `const bool&` should bind to anything, be it `const` or not, an rvalue or an lvalue, so I doubt that this change is breaking anything.
2020-11-02 16:01:17 +01:00
Martin Hořeňovský 4c8454b5ec
Fix potential infinite loops in generators combined with section filter
The problem was that under specific circumstances, namely that none
of their children progressed, `GeneratorTracker` will not progress.
This was changed recently, to allow for code like this, where a
`SECTION` follows a `GENERATE` at the same level:

```cpp
SECTION("A") {}
auto a = GENERATE(1, 2);
SECTION("B") {}
```

However, this interacted badly with `SECTION` filters (`-c foo`),
as they could deactivate all `SECTION`s below a generator, and thus
stop it from progressing forever. This commit makes GeneratorTracker
check whether there are any filters active, and if they are, it checks
whether its section-children can ever run.

Fixes #2025
2020-10-23 21:21:15 +02:00
Martin Hořeňovský 8878f90323
Fix matching of non-lowercase filename tags
The bug was caused by forgetting to lower-case the filename tag
for matching against test spec.

Fixes #2064
2020-10-22 16:20:41 +02:00
Martin Hořeňovský 923bcc5d6f
Special case --list-tests --verbosity quiet
The new output (mostly) follows the old `--list-test-names-only`
format, with the exception of no longer supporting line output
for `--verbosity high`.

Fixes #2051
2020-10-20 15:09:48 +02:00
Martin Hořeňovský b6a3e2e26b
Merge pull request #2058 from catchorg/devel-generators-cache
Fix types in generators: decay types, properly constrain forwarding
2020-10-20 12:46:31 +02:00
Martin Hořeňovský 6ffac61719
Fix types in generators: decay types, properly constrain forwarding
Fixes #2040
Closes #2012
2020-10-20 10:57:37 +02:00
Michael Vlach 4b2bc8757c Update catch_compiler_capabilities.hpp 2020-10-10 17:56:43 +02:00
Martin Hořeňovský b9853b4b35
Bump version to v3.0.0 preview 3 2020-10-08 15:26:30 +02:00
Martin Hořeňovský 3f9e779542
Improve detection of std::uncaught_exceptions support
The problem was that Catch2 did not reliably include `<exception>`
before it checked for the feature test macro for
`std::uncaught_exceptions`. To avoid overhead of including
`<exception>` everywhere, the configuration check was split out
into a separate header.

Closes #2021
2020-10-08 12:39:50 +02:00
Martin Hořeňovský b601b7faca
Workaround AppleClang bug by renaming TestHasher constructor argument
As far as I understand the standard, if there is a function called
`rng` in the global namespace, and a function argument called `rng`,
then the argument should shadow the function. This then means that
uses of `rng` inside the function should refer to the argument.

This is not the case for AppleClang 12.0.0. Luckily the workaround
is simple enough; just rename the argument. Given that the function
is 3 lines and uncomplicated, the change of the name doesn't really
affect readability.

Still, WTF AppleClang?

Closes #2030
2020-10-08 11:41:05 +02:00
Will Pazner a4dfcf9042
Disable __builtin_constant_p when compiling with nvcc 2020-10-08 11:34:57 +02:00
Travis Wilson b0214ff862
Make experimental capture work on Windows with read-write temp file behavior 2020-10-08 11:28:50 +02:00
Martin Hořeňovský 99d70c0c9d
Remove superfluous whitespace before #include 2020-09-07 20:01:04 +02:00
Dawid Kurek 8f44e09a72
Remove superfluous values
The `0`s were needed for the expansion of parameter pack for the sake of
expander. Now when we have `index++` it is no more needed.
2020-09-07 14:30:58 +02:00
Sean Middleditch 31d4831245
Support sentinel-based ranges in default stringify (#2004) 2020-09-07 14:23:47 +02:00
Gregory Bond 5ad1a4fe61
Issue 1992: Better c++17 std::byte detection
This fixed buld errors for ubuntu-16 + clang and similar situations
where C++17 is supported in the compiler but not the default
C++ standard library.
2020-09-07 13:01:51 +02:00
Martin Jeřábek 8851e779cf console colour: fix unintended colouring of user's stderr on POSIX
At some places, the colour reset code is printed after a newline.
Since the default output buffering to console is line-based, the reset
code is not actually written out. If messages from user code are printed
to stderr (different stream, same console), they are printed before
the colour reset code, and thus they are coloured.

Explicitly flushing the stream after writing the colour escape code solves
this.
2020-09-07 11:53:45 +02:00
Martin Hořeňovský 9155a9ff20
Fix -Wparentheses issue on g++9 2020-09-06 16:02:01 +02:00
Martin Hořeňovský cc18bd719d
Sweep out Wshadow
Most of the changes are completely pointless renaming of constructor
arguments so that they do not use the same name as the type members,
but 🤷

Closes #2015
2020-09-06 13:11:42 +02:00
Martin Hořeňovský 90aeffb97d
Add standardized copyright notice + SPDX identifier to source files
This should also be done for test files, but that has lower priority.
2020-08-30 15:43:45 +02:00
Martin Hořeňovský c2453c2bf8
Remove the rest of old-style copyright headers 2020-08-30 14:45:05 +02:00
Martin Hořeňovský a822cb9717
Standardize include guard patterns to FILE_NAME_EXTENSION_INCLUDED
This commit also strips the old copyright comment header in touched
files, as those will also be replaced with a more standardized and
machine-friendly version.
2020-08-30 14:09:27 +02:00
Martin Hořeňovský c26693df23
Fix doccomment on shouldShowDuration reporter helper 2020-08-29 19:55:17 +02:00
Martin Hořeňovský 33ad1ee2ac
Split EventListener base from streaming_base.hpp
The base was also renamed from `TestEventListenerBase` to
`EventListenerBase`, and modified to derive directly from the
reporter interface, rather than deriving from `StreamingReporterBase`.
2020-08-29 19:09:54 +02:00
Martin Hořeňovský f9fdc96cbf
Push LazyStat down into catch_reporter_streaming_base.hpp 2020-08-24 11:27:21 +02:00
Martin Hořeňovský 360b82620e
Refactor serializeFilters implementation 2020-08-24 10:19:26 +02:00
Martin Hořeňovský 2a8e317cfb
Split various reporter helpers out from streaming_base.hpp
Due to also adding a new TU, there is no improvement to the
compilation times of the static library, but it improves the
compilation times of consumer's reporter TUs.
2020-08-24 10:19:24 +02:00
Martin Hořeňovský 6a08d401aa
Split out ReporterFactory out of catch_interfaces_reporter.hpp 2020-08-23 22:35:01 +02:00
Martin Hořeňovský 9677df6d8b
Split IReporterRegistry into its own header file
Doing this removes `<map>` from the include set of the base reporter
interface, and thus from bunch more TUs. This provides about 1.5%
improvements in the debug build of the static library, and 1% in
release build.
2020-08-23 21:01:04 +02:00
Martin Hořeňovský ed7eaf2df3
Split catch_reporter_bases.hpp into two separate headers
Each of the two reporter bases now has its own header file, and
cpp file. Even though this adds another TU to the compilation,
the total CPU time taken by compilation is reduced by about 1%
for debug build and ~0.5% for optimized build of the main library.
(The improvement would be roughly doubles without splitting the TUs,
but the maintainability hit is not worth it.)

The code size of the static library build has also somewhat decreased.

Follow up: Introduce combined TU for reporters, and further split
apart the catch_reporter_streaming_base.hpp header into its
constituent parts, as it still contains a whole bunch of other stuff.
2020-08-23 07:30:26 +02:00
Martin Hořeňovský 24559493bf
Anchor some Clara vtables into the cpp file
Anchoring the vtables does 2 things
1) Fixes some instances of `-Wweak-vtables`
2) Decreases code size and linker pressure

However, there are still some unanchored ones, and thus we have
to keep suppressing `-Wweak-vtables` warning for Clang.
2020-08-20 23:16:11 +02:00
Martin Hořeňovský 7500ad1ffd
Turn Clara::Detail::ResultBase::Type into its own enum class 2020-08-20 22:59:06 +02:00
Martin Hořeňovský 1a97af45f1
Cleanup some stuff found by MSVC's /analyze
* Added some missing `noexcept`s on custom destructors.
* Fixed `std::move` being called on a const-reference.
* Initialized `ScopedMessage::m_moved` in class definition, instead
of doing so in constructors explicitly.
* Turned some `enum`s into `enum class`es.
* Initialized `StreamingReporterBase::currentTestCaseInfo` in class
definition.
* Some cleanups in SelfTest code.
2020-08-20 20:42:21 +02:00
Martin Hořeňovský 2e480b6e56
Use StringRef for CasedString::caseSensitivitySuffix return type 2020-08-18 21:02:34 +02:00
Martin Hořeňovský e418e75c74
Turn CaseSensitive into proper enum class 2020-08-18 21:02:30 +02:00
Martin Hořeňovský 6a46b344c0
Split out CaseSensitive enum out of catch_common.hpp
Only very few places actually use it, so there is no need to have
it be central to everywhere.
2020-08-18 21:02:25 +02:00
Martin Hořeňovský e7eb749815
Split the NonCopyable helper out of catch_common.hpp 2020-08-18 21:02:23 +02:00
Martin Hořeňovský c1bb699d45
Remove superfluous catch_reporter_registrars.hpp includes from reporters
The includes were an artifact of the old design where the built-in
reporter TUs used autoregistration to add the reporters to the
factory. Because the current design is to add them explicitly in
the central reporter factory TU, the includes are useless.
2020-08-14 09:33:53 +02:00
Martin Hořeňovský bf1e902ca1
Remove <algorithm> include from catch_commandline.cpp 2020-08-14 09:33:42 +02:00
Martin Hořeňovský 49b55d53e4
Prune includes in catch_run_context.cpp 2020-08-14 09:33:28 +02:00
Martin Hořeňovský 07fb96d42c
Don't include catch_random_number_generator.hpp in catch_session.cpp 2020-08-14 09:33:16 +02:00
Martin Hořeňovský 34d9a588bb
Cleanup includes in catch_list.cpp 2020-08-14 09:32:59 +02:00
Martin Hořeňovský 05d7014e75
ApproxMacher uses Approx's overloads for double directly
This saves a tiny little bit of compilation times when the
`ApproxMatcher` is used and `epsilon`, `margin`, or `scale` are
used to customize its behaviour.
2020-08-11 19:07:37 +02:00