Commit Graph

304 Commits

Author SHA1 Message Date
Martin Hořeňovský e5e9afad16
Fix headers whose surrogate TUs did not compile 2021-02-19 23:22:43 +01:00
Martin Hořeňovský 477540760a
Use gmtime_r instead of gmtime when compiling for posixy platforms 2021-01-27 11:49:52 +01:00
Martin Hořeňovský 971b1fc32a
--list-* flags write to target specified by the -o flag
Also added tests for the default implementations of list* reporter
helpers.

Closes #2061
2021-01-26 18:36:54 +01:00
Martin Hořeňovský 6798c139a6
Extract the default listing implementation out of reporter interface
Also generalized the implementations to write to the provided
output stream, which will be required for the follow up changes,
where the listings should happen to the location user asked for
by specifying the `-o` flag.
2021-01-26 11:23:37 +01:00
Martin Hořeňovský 7111b2a8e2
Cleanup IStreamingReporter::listTests 2021-01-16 15:50:52 +01:00
Martin Hořeňovský 5509ceff60
Remove superfluous IConfig argument from IStreamingReporter::list*
The previous commit made it so that the `IConfig` is stored in
`IStreamingReporter` and thus always available.
2021-01-16 15:48:29 +01:00
Martin Hořeňovský 74f2f4ba5e
Hold reporter's IConfig instance in the interface
Previously, every base derived from the IStreamingReporter had
its own `IConfig const* m_config` member, so this just centralizes
the handling thereof.

Part of #2061
2021-01-16 15:27:56 +01:00
Martin Hořeňovský 4e8832fc88
Split CATCH_CONFIG_COUNTER into its own header
Part of #2041
2020-12-29 11:07:45 +01:00
Martin Hořeňovský bdd1e5c613
Remove some superfluous includes 2020-12-28 21:11:54 +01:00
Martin Hořeňovský 1d269211bd
Split CATCH_CONFIG_WCHAR into its own header
Part of #2041
2020-12-28 20:51:49 +01:00
Roman Proskuryakov 0acb371b92
Fix Wold-style-cast error (#2125)
* Add Wold-style-cast to cmake flags
* Fix old style cast in catch_stats.hpp
* Fix old style cast in catch_stats.cpp
2020-12-28 14:00:19 +01:00
Martin Hořeňovský 965afc4b2e Split CATCH_CONFIG_ANDROID_LOGWRITE into its own header
Part of #2041
2020-12-28 12:53:52 +01:00
Uriel García Rivas 552af8920d Added AnyMatch, AllMatch and NoneMatch 2020-12-27 20:20:55 +01:00
Martin Hořeňovský a091853f4a
Rename file catch_matchers_floating -> catch_matchers_floating_point
The old name was a legacy of v2 era, where all headers were stitched
into one. With v3 using separate headers, it is better when they have
proper name.
2020-12-13 18:12:20 +01:00
Martin Hořeňovský 4b51d0dd3b
Remove rest of std::shared_ptr usage in Trackers
Closes #2088
2020-12-05 15:19:23 +01:00
Martin Hořeňovský 6350851f9a
Return plain ptr from ITracker::findChild instead of shared_ptr
This is part of wider rework of trackers to avoid `std::shared_ptr`
everywhere.

Related to #2088
2020-12-04 21:37:24 +01:00
cat_mint 21c97f2fad
Use snprintf instead of sprintf (#2111) 2020-12-01 18:59:27 +01:00
Martin Hořeňovský e7740316e3
Split TestFailureException into its own header 2020-11-28 11:18:54 +01:00
Martin Hořeňovský 72525a3053
Rename catch_common.hpp -> catch_source_line_info.hpp
Previous splitting of catch_common.hpp left it containing only one
actual thing, which is the `SourceLineInfo` type. Given that, there
is no reason to keep the old name.

Also found out that it was included in some places for no reason
(primarily Matchers).
2020-11-28 11:18:51 +01:00
Martin Hořeňovský 1982c0d5ee
Split out the StreamEndStop helper into its own header 2020-11-28 11:18:46 +01:00
Martin Hořeňovský c3e8ae642f
Remove pointless virtual in WildcardPattern 2020-11-26 18:35:20 +01:00
Martin Hořeňovský f36e059453
Remove superfluous <memory> include from catch_reporter_cumulative_base.hpp 2020-11-26 18:06:21 +01:00
Martin Hořeňovský 677adf8ade
Replace shared_ptrs with unique_ptrs in CumulativeReporterBase nodes
Closes #2089
2020-11-26 14:45:27 +01:00
Martin Hořeňovský bfe5553416
CumulativeReporterBase doesn't use shared_ptrs for sectionStack 2020-11-26 10:21:12 +01:00
Martin Hořeňovský c673db7a4e
Add explanatory comment to CumulativeReporterBase 2020-11-26 09:45:28 +01:00
Martin Hořeňovský b10a19545b
CumulativeReporterBase stores TestRunNodes directly 2020-11-26 09:43:23 +01:00
Martin Hořeňovský e5ccb79bf8
Remove pointless virtual on StreamingReporterBase::Node destructor 2020-11-25 21:57:30 +01:00
Martin Hořeňovský 3610eb81b1
Explicitly inline trivial function in CumulativeReporterBase impl 2020-11-17 21:02:11 +01:00
Martin Hořeňovský bd1e76cc3a
Untypedef some types for clarity when refactoring 2020-11-17 21:01:35 +01:00
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