Commit Graph

3838 Commits

Author SHA1 Message Date
Martin Hořeňovský
bf5c58adf6 The limit on TEMPLATE* test cases is actually reachable 2021-10-21 15:52:07 +02:00
Alecto Irene Perez
06cf2a4724 Apply PR #2297 to devel branch (#2300)
* Apply PR #2297 to devel branch

It turns out that Issue #2272 partially affected the devel branch. When
building tests with C++20, the compiler emits a warning that top-level
comma expressions in array subscripts are depricated. Warnings are
treated as errors, so this caused the build to fail.

This commit adds localized warning suppression
in accordance with this recommendation here:
https://github.com/catchorg/Catch2/pull/2297#discussion_r720848392

Signed-off-by: Alecto Irene Perez <perez.cs@pm.me>

* Fixed unknown pragma warning on old versions of gcc & clang

This commit fixes an unkwown pragma warning on older versions of GCC
and Clang. These older versions don't have a warning for depricated use
of the comma subscript. Because warning suppression is localized, and
only refers to the comma subscript warning, it doesn't affect compiler
warnings in other parts of the code.

Signed-off-by: Alecto Irene Perez <perez.cs@pm.me>

* More #warning backwards compatibility fixes

Signed-off-by: Alecto Irene Perez <perez.cs@pm.me>
2021-10-21 15:47:21 +02:00
Martin Hořeňovský
4436a60456 Add myself to FUNDING 2021-10-11 10:44:29 +02:00
Martin Hořeňovský
36b4a71ff0 Pick release notes for 2.13.7 2021-10-10 22:23:14 +02:00
Martin Hořeňovský
b406ad52a7 Mark !mayfail tests as skipped in the JUnit reporter
Should fix #2116
2021-10-10 22:21:39 +02:00
Martin Hořeňovský
de67278e14 JUnit reporter uses only 3 decimal places when reporting durations
We used to use whatever precision we ended up having from C++'s
stdlib. However, some relatively popular tools, like Jenkins,
use Maven SureFire XML schema to validate JUnit test reports, and
Maven SureFire schema requires the duration to have at most 3
decimal places.

For compatibility, the JUnit reporter will now respect this
limitation.

Closes #2221
2021-10-10 22:10:48 +02:00
Martin Hořeňovský
1d9696d22d Cleanup reporting of rng seed in existing reporters 2021-10-09 00:02:30 +02:00
Martin Hořeňovský
ed1f343a41 Provide random-device option for --rng-seed and make it default 2021-10-08 21:35:45 +02:00
Martin Hořeňovský
200a487cf2 Add generateRandomSeed utility to generate randomness seed 2021-10-08 21:35:41 +02:00
Martin Hořeňovský
fce42b62ad Generate random rng seed if user did not specify one
Closes #2161
2021-10-08 21:35:29 +02:00
Martin Hořeňovský
4e6d306742 Rename Catch::Option to Optional 2021-10-05 20:39:28 +02:00
Martin Hořeňovský
c6c46a168f Add non-empty assertion to Option's deref op 2021-10-05 19:22:22 +02:00
Martin Hořeňovský
48a889859b Simplify how ratio symbol is returned when stringifying ratios 2021-10-03 20:23:10 +02:00
Martin Hořeňovský
d65ee04b74 Remove double serialization when stringifying std::optional 2021-10-03 20:19:36 +02:00
Martin Hořeňovský
928e198ef2 Demote some single character strings into plain chars 2021-10-03 10:37:30 +02:00
Martin Hořeňovský
3e9c6fec22 Remove XmlWriter::writeBlankLine
There is no good reason to provide a "add empty line" primitive
for writing XML documents, and the fact that it remains unused
after all the time it was provided only confirms this further.
2021-10-02 14:39:54 +02:00
Martin Hořeňovský
13670f535f Add more tests for XmlWrite::write* members 2021-10-02 14:39:52 +02:00
Martin Hořeňovský
c6640e4f47 Improve documentation of CATCH_MOVE and CATCH_FORWARD 2021-09-30 20:40:24 +02:00
Martin Hořeňovský
23f0d94b4f Use CATCH_FORWARD in Detail::make_unique 2021-09-30 20:27:38 +02:00
Martin Hořeňovský
77c7e9803e Improve documentation on Detail::unique_ptr 2021-09-30 20:17:59 +02:00
Martin Hořeňovský
1d79683ea8 Add [[trivial_abi]] to Detail::unique_ptr when compiled with Clang
This decreases code size and improves performance of passing around
`unique_ptr` instances by value somewhat. It virtually guarantees
problems when combining code compiled with Clang and GCC, but that
was never supported anyway.
2021-09-30 20:11:22 +02:00
Anders Schau Knatten
eb452e9b35 Bring back useful comment
In b7b346c3e5 this conditional was simplified to just
`while( false)` rather than the current one. Then in 3a33315ff8, that
change was reverted. I found it hard to understand this
complicated conditional, but after some digging in history I found this
comment which used to be here. It was removed in b7b346c3e5, but not
restored together with the revert in 3a33315ff8. Let's revive it.
2021-09-29 18:19:31 +02:00
Martin Hořeňovský
2deafc33e9 Demote getCurrentNanosecondsSinceEpoch to internal linkage 2021-09-29 11:26:38 +02:00
Martin Hořeňovský
5250cf6d58 Remove getEstimatedClockResolution from Timer
It used to be part of the experimental benchmarking support, but
since that was replaced with proper benchmarking support with its
own timer facilities, it is now a dead code and useless.
2021-09-29 11:24:18 +02:00
Martin Hořeňovský
426954032f Rename Contains string matcher builder to ContainsSubstring
The problem with the old name was that it collided with the
range matcher `Contains`, and it was not really possible to
disambiguate them just with argument types.

Closes #2131
2021-09-27 21:28:33 +02:00
Martin Hořeňovský
f02c2678a1 Use StringRef for className in TestCaseInfo 2021-09-27 19:07:45 +02:00
Martin Hořeňovský
21b99d6f58 Add StringRef::compare for three way comparison 2021-09-27 18:41:17 +02:00
Martin Hořeňovský
d42e7a23a0 Change startsWith(char) to take StringRef as argument 2021-09-27 14:55:28 +02:00
Martin Hořeňovský
7bb00a42be Remove stub of obsolete test 2021-09-27 14:45:39 +02:00
Martin Hořeňovský
fb4153e05e Multiple tests can have same name as long as their tags differ
This change also changes it so that test case macros using a
class name can have same name **and** tags as long as the
used class name differs.

Closes #1915
Closes #1999
2021-09-25 21:37:03 +02:00
Martin Hořeňovský
e8e28ba401 Remove obsolete documentation page 2021-09-23 23:42:16 +02:00
Bernhard Manfred Gruber
ee1435793e add alpaka and LLAMA to Catch2 users 2021-09-23 12:39:56 +02:00
Martin Hořeňovský
3f8cae8025 Add consistency-checking event listener to SelfTest
This event listener performs basic consistency checks (akin to
matching braces) on events that are passed to the listeners
when the `SelfTest` test binary is run.

The current checks are about nesting events (e.g. `testCaseStarting`
cannot be received before `testRunStarting`, `sectionStarting`
can only be received when a test case is active, etc), and matching
up counts of starting/ended events.

The simplicity means that it could be confused by starting/ended
events matching up but being out of order, e.g.
```
* test case A starting
* test case B ended
* test case B starting
* test case A ended
```
would be accepted, even though it is wrong. However, doing full
order checking would be much more implementation work, for relatively
little benefit, so it is left out for now.
2021-09-15 23:38:43 +02:00
Martin Hořeňovský
2c82f82ee2 Mark first party reporters final
They are not intended to be derived from, so forbidding it
explicitly improves our ability to refactor them later.
2021-09-15 21:29:18 +02:00
Martin Hořeňovský
785436cd74 Make benchmark* and fatalError reporter events pure virtual 2021-09-15 21:17:39 +02:00
Martin Hořeňovský
f314fa1f8c assertionEnded event in reporters no longer returns bool 2021-09-15 18:57:56 +02:00
Martin Hořeňovský
013edc208b Refactor noMatchingTestCases and skipTests reporter methods
They now take `StringRef` as the argument, and are virtual only
in the basic interface.

Also cleaned out the various reporters and their overrides
of these members which were often empty or delegating up.
2021-09-15 18:08:31 +02:00
Martin Hořeňovský
10fb93cce8 Add new reporter event called for each test case enter/exit
This means that e.g. for `TEST_CASE` with two sibling `SECTION`s
the event will fire twice, because the `TEST_CASE` will be entered
twice.

Closes #2107 (the event mentioned there already exists, but this
is its counterpart that we also want to provide to users)
2021-09-14 13:19:45 +02:00
Martin Hořeňovský
4dcf8382c7 Default-implement assertion* events in StreamingReporterBase
This means that a reporter deriving from `StreamingReporterBase`
does not have to override them if it isn't interested in the individual
assertions.
2021-09-14 12:41:24 +02:00
Biswapriyo Nath
efd8cc8777 pkgconfig: Add missing entries
This adds prefix and exec_prefix fields
2021-09-11 19:02:21 +02:00
Martin Hořeňovský
12bca890b7 Use StringRefs in SectionTracker's filter bookkeeping 2021-09-09 11:04:34 +02:00
Martin Hořeňovský
317db82396 Use StringRef in more places in reporters 2021-09-09 10:41:09 +02:00
Martin Hořeňovský
cf5ccaa9df AssertionResult::getMessage returns StringRef to internal string 2021-09-08 10:08:07 +02:00
Martin Hořeňovský
b3a84c7983 Use StringRef in pluralise implementation
This means that it can no longer be safely made ahead of time,
but nothing in our existing code used it like that. Normally it
is constructed and used in the same expression, which is now
more efficient.
2021-09-08 00:24:40 +02:00
Martin Hořeňovský
c0f866c7cf Make CumulativeReporterBase's members protected 2021-09-08 00:23:37 +02:00
Martin Hořeňovský
29caae5ce5 Pass around the test suite name by StringRef 2021-09-08 00:01:31 +02:00
Martin Hořeňovský
ea49210eae Remove Config::getProcessName because it was unused 2021-09-08 00:00:16 +02:00
Martin Hořeňovský
e4719fb51c Update release notes with new fixes, improvements and breaking changes 2021-09-07 22:00:57 +02:00
Martin Hořeňovský
290c1b60e6 Store singular TestRunNode in CumulativeReporterBase
There can never be more than one, so there is no reason to provide
genericity over multiple nodes.
2021-09-07 21:18:48 +02:00
Martin Hořeňovský
e5938007f7 Completely remove the testGroup events
This was done because they were 1:1 mapping to testRun events, and
I could not think of a reasonable way to make them their own thing.
2021-09-07 20:00:22 +02:00