Commit Graph

4506 Commits

Author SHA1 Message Date
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
Martin Hořeňovský
ab3fe0053d
Remove superfluous warning suppression from console reporter 2021-09-07 19:57:55 +02:00
Martin Hořeňovský
432d03d1aa
Use -Wextra-semi instead of -Wextra-semi-stmt for stricter warnings 2021-09-02 11:04:55 +02:00
Roc
9ac9fb164e
Suffix the library name with 'd' for debug builds 2021-08-28 00:47:54 +02:00
Martin Hořeňovský
07018e2fba
Force __cdecl calling convention for wmain
Fixes #2219
2021-08-26 23:13:27 +02:00
Martin Hořeňovský
ff0a5227ca
Make Approx::operator() const
Closes #2273
2021-08-26 21:27:43 +02:00
Martin Hořeňovský
54edab53bf
Add missing include to benchmark/catch_execution_plan.hpp
Fixes #2275
2021-08-26 20:19:25 +02:00
Martin Hořeňovský
0a8516aeea
Use make_unique when registering an exception translator 2021-08-21 21:32:15 +02:00
Martin Hořeňovský
928ecbaccf
Change callable/model::clone to return a unique_ptr 2021-08-21 21:00:00 +02:00
Martin Hořeňovský
1cbbc5d2cb
Add test for !shouldfail and failed benchmarks 2021-08-21 00:06:31 +02:00
Martin Hořeňovský
7f3297f7e8
Sweep out unused <utility> includes 2021-08-19 21:44:17 +02:00
Martin Hořeňovský
7ff54ebc06
Add _t suffix typedef for internal traits 2021-08-19 21:29:41 +02:00
Martin Hořeňovský
ca8546efc6
Mention C++14 baseline in contributing documentation 2021-08-19 19:16:12 +02:00
Martin Hořeňovský
4113a12c69
Fix Wreserved-identifier for UDLs in Catch2
See #578
2021-08-19 19:15:46 +02:00
Martin Hořeňovský
edad4d0af7
Prefer _t over ::type form for std type traits 2021-08-19 00:21:13 +02:00
Martin Hořeňovský
88c27ffaf2
Mention CATCH_MOVE and CATCH_FORWARD in contributing docs 2021-08-16 16:22:21 +02:00
Martin Hořeňovský
d2ee7100d2
Replace uses of std::move and std::forward with macros
This improves the SelfTest build times by about 3% (measured
with Clang 10 on random Linux box I had lying around).
2021-08-16 16:22:19 +02:00
Martin Hořeňovský
03ce304102
Add std::move/std::forward replacement macros
Using the `CATCH_MOVE` and `CATCH_FORWARD` macros instead of the
`std::move` and `std::forward<T>` utility functions can improve
compilation times and debug build's performance, and thus will
be preferred going forward.
2021-08-16 16:22:16 +02:00
Geoffrey M Gunter
7040f03b54 Fix typo in docs/matchers.md
There were a few instances in matchers.md where header files erroneously
had a .h file extension instead of .hpp
2021-08-16 15:19:49 +02:00
Martin Hořeňovský
1554251f97
Fix typo in docs/cmake-integration.md 2021-08-11 22:57:36 +02:00
Martin Hořeňovský
2b54f1e7a6
Remove superfluous catch_enforce include from complete_invoke
Also added missing transitive include to `catch_benchmark.hpp`.
2021-08-11 22:52:04 +02:00
Martin Hořeňovský
2c84854b90
Use unique_ptr to hold Environment measurements in benchmarking 2021-08-11 22:52:01 +02:00
Martin Hořeňovský
3579c055c8
Use Detail::make_unique<T> in more places 2021-08-11 22:51:59 +02:00
Martin Hořeňovský
3ec63324a8
Replace owning naked IStream pointers with unique_ptrs 2021-08-11 22:51:57 +02:00
Martin Hořeňovský
7d0770adf2
Merge pull request #2269 from numaru/feature/rename-contrib-in-docs
Rename contrib/ to extras/ in the docs
2021-08-11 00:26:38 +02:00
Kin Numaru
74db06199b
Rename contrib/ to extras/ in the docs
The directory has been renamed in 918aa32 but the doc was not updated
yet.
2021-08-10 10:41:16 +02:00
Martin Hořeňovský
52a3144145
Update users docs 2021-08-08 23:42:24 +02:00
Martin Hořeňovský
a62974eb6a
Update why-catch.md 2021-08-08 23:42:17 +02:00
Martin Hořeňovský
a0d84654dd
Add GitHub Actions badges to README 2021-08-07 21:18:00 +02:00
Martin Hořeňovský
557e5118f1
Remove TravisCI badge 2021-08-07 16:25:22 +02:00
Martin Hořeňovský
0a3f511cfe
Fix inconsistencies in reporting benchmarking failures
With these changes, all these benchmarks
```cpp
BENCHMARK("Empty benchmark") {};
BENCHMARK("Throwing benchmark") {
    throw "just a plain literal, bleh";
};
BENCHMARK("Asserting benchmark") {
    REQUIRE(1 == 2);
};
BENCHMARK("FAIL'd benchmark") {
    FAIL("This benchmark only fails, nothing else");
};
```

report the respective failure and mark the outer `TEST_CASE` as
failed. Previously, the first two would not fail the `TEST_CASE`,
and the latter two would break xml reporter's formatting, because
`benchmarkFailed`, `benchmarkEnded` etc would not be be called
properly in failure cases.
2021-08-07 15:16:11 +02:00
Martin Hořeňovský
9ef510b769
Remove unused travis yaml 2021-08-07 15:09:50 +02:00
Martin Hořeňovský
1b1f3a88bc
Don't debug log empty strings 2021-08-06 11:38:54 +02:00