Commit Graph

4212 Commits

Author SHA1 Message Date
Martin Hořeňovský
16f48f8c7c
Add SUCCEED and FAIL docs next to SKIP docs 2023-01-12 20:38:58 +01:00
Martin Hořeňovský
367c2cb248
Update doc about what counts as unique test case 2023-01-12 15:26:32 +01:00
Philip Salzmann
d548be26e3
Add new SKIP macro for skipping tests at runtime (#2360)
* Add new SKIP macro for skipping tests at runtime

This adds a new `SKIP` macro for dynamically skipping tests at runtime.
The "skipped" status of a test case is treated as a first-class citizen,
like "succeeded" or "failed", and is reported with a new color on the
console.

* Don't show "skipped assertions" in console/compact reporters

Also extend skip tests to cover a few more use cases.

* Return exit code 4 if all test cases are skipped

* Use LightGrey for the skip colour

This isn't great, but is better than the deep blue that was borderline
invisible on dark backgrounds. The fix is to redo the colouring
a bit, including introducing light-blue that is actually visible.

* Add support for explicit skips in all reporters

* --allow-running-no-tests also allows all tests to be skipped

* Add docs for SKIP macro, deprecate IEventListener::skipTest

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2023-01-12 15:01:47 +01:00
Sam James
52066dbc2a Fix build with GCC 13 (add missing <cstdint> include)
GCC 13 (as usual for new compiler releases) shuffles around some
internal includes and so <cstdint> is no longer transitively included.

Explicitly include <cstdint> for uint64_t.

```
FAILED: src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o
/usr/lib/ccache/bin/g++-13  -I/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/.. -I/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1_build/generated-includes  -O2 -pipe
-march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -D_GLIBCXX_ASSERTIONS  -ggdb3 -fdiagnostics-color=always
-ffile-prefix-map=/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1=. -Wall -Wc++20-compat -Wcast-align -Wcatch-value -Wdeprecated -Wexceptions -Wextra -Wextra-semi -Wfloat-equal -Winit-self
-Wmisleading-indentation -Wmismatched-new-delete -Wmismatched-tags -Wmissing-braces -Wmissing-declarations -Wmissing-noreturn -Wnull-dereference -Wold-style-cast -Woverloaded-virtual -Wparentheses
-Wpedantic -Wreorder -Wshadow -Wstrict-aliasing -Wsuggest-override -Wundef -Wuninitialized -Wunreachable-code -Wunused -Wunused-function -Wunused-parameter -Wvla -MD -MT
src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o -MF src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o.d -o src/CMakeFiles/Catch2.dir/catch2/internal/catch_clara.cpp.o -c
/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/internal/catch_clara.cpp
In file included from /var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/internal/catch_clara.cpp:12:
/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/../catch2/internal/catch_string_manip.hpp:47:14: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
   47 |         std::uint64_t m_count;
      |              ^~~~~~~~
      |              wint_t
/var/tmp/portage/dev-cpp/catch-3.0.1/work/Catch2-3.0.1/src/catch2/../catch2/internal/catch_string_manip.hpp:51:42: error: expected ')' before 'count'
   51 |         constexpr pluralise(std::uint64_t count, StringRef label):
      |                            ~             ^~~~~~
      |                                          )
```
2023-01-08 20:08:58 +01:00
TrueWodzu
cdf604f30e Update command-line.md
Typo in "--list-reporter" link, should be "--list-reporters"
2023-01-08 19:37:16 +01:00
Martin Hořeňovský
04382af4c6
Slightly better clang-format
Notably clang-format will no longer try to place template header
onto the same line as the function declaration.

Sadly it will still do it for attributes, because it took until
clang-format 16 for it to get the relevant option.
2023-01-05 23:02:51 +01:00
Martin Hořeňovský
ac93f19437
Improved path normalization in approvalTests.py
Instead of redoing the whole line where path was found, only the
directory part of the path is removed, instead of removing all
of the line before the path starts.

This results in slight change in how junit and sonarqube approvals
come out, and significant change in how TeamCity reporter approvals
come out. This latter difference is the reason for the change,
as now the lines with `testFailed` and `testIgnored` messages
are not completely butchered.
2023-01-01 20:27:59 +01:00
Martin Hořeňovský
72b60dfd28
Cleanup the Windows GHA builds
* Use CMD as the shell and simplify configure/build steps
* Include plaform in the build name
2022-12-30 23:58:05 +01:00
Martin Hořeňovský
0c62167fea
Merge pull request #2604 from ChrisThrasher/generated_includes_directory
Keep generated headers within project binary directory
2022-12-28 21:19:53 +01:00
Chris Thrasher
1be954ff70
Keep generated headers within project binary directory
This stops them from appearing in the build directories of projects
that may consume Catch2.
2022-12-26 22:44:35 -06:00
Martin Hořeňovský
78bb4fda05
Mention that the benchmarks are not run by default next to example 2022-12-18 21:42:40 +01:00
Martin Hořeňovský
e6ec1c238b
Fix benchmarking example in the main readme
This uses the same fibonacci implementation as is used in the
benchmark test.

Closes #2568
2022-12-18 21:33:45 +01:00
mrbald
477c1f5152 Fixed typo in code example in top level README.md 2022-12-17 21:34:37 +01:00
Martin Hořeňovský
f8b9f77259
Prune Appveyor builds 2022-12-16 22:37:33 +01:00
Martin Hořeňovský
77fbacb03f
Add VS 2019-2022 C+14/17 jobs to GHA
For now I added only the basic build matrix, without coverage
collection and more special builds, like WMAIN.

However, due to GHA being so much faster than AppVeyor, all
these builds are now done against the 'all-tests' prefix, making
the builds more uniform than they were on AppVeyor.
2022-12-16 22:34:33 +01:00
lbckmnn
e3fc97dffb
fix compiler warning in parseUint and catch only relevant exceptions (#2572) 2022-12-12 12:15:42 +01:00
lbckmnn
9c0533a905
Add MessageMatches matcher for exception (#2570) 2022-12-12 00:40:47 +01:00
Martin Hořeňovský
ed02710b83
Make AutoReg in test registration macros const 2022-12-10 21:37:21 +01:00
Sergio Arroutbi
8b84438be4 Avoid usage of master when possible
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
2022-12-09 23:22:10 +01:00
Martin Hořeňovský
ab6c7375be
v3.2.1 2022-12-09 23:10:18 +01:00
Martin Hořeňovský
24607694cb
Move Catch::always_false into decomposer.hpp 2022-12-09 16:18:33 +01:00
Martin Hořeňovský
28e651f152
Move SFINAE in decomposer into return type
This is needed so that we can use conjunction and other logical
type traits to workaround issue with older GCC versions (8 and
below), when they run into types that have ambiguous constructor
from `0`, see e.g. #2571.

However, using conjunction and friends in the SFINAE constraint
in the template parameter breaks for C++20 and up, due to the new
comparison operator rewriting rules. With C++20, when the compiler
see `a == b`, it also tries `b == a` and collects overload set
for both of these expressions.

In Catch2, this means that e.g. `REQUIRE( 1 == 2 )` would lead
the compiler to check overloads for both `ExprLhs<int> == int`
and `int == ExprLhs<int>`. Since the overload set and SFINAE
constraints assume that `ExprLhs<T>` is always on the left side,
when the compiler tries to resolve the template parameters, all
hell breaks loose and the compilation fails.

By moving the SFINAE constraints to the return type, the compiler
can discard the switched expression without having to resolve
the complex SFINAE constraints, and thus everything works the
way it is supposed to.

Fixes #2571
2022-12-09 00:40:01 +01:00
Martin Hořeňovský
2d7be1f7de
Add Clang-10 and GCC-10 C++20 builds 2022-11-22 16:17:18 +01:00
Martin Hořeňovský
1f3b51e903
Use logo with bit of white background in README
Closes #2573
2022-11-22 16:13:37 +01:00
Martin Hořeňovský
a20200be7e
Revert "Fix old GCC + types with ambiguous constructor from 0"
This reverts commit 291c502f66.

The issue is that it breaks under C++20 for some reason.
2022-11-22 15:23:03 +01:00
Martin Hořeňovský
291c502f66
Fix old GCC + types with ambiguous constructor from 0
Closes #2571
2022-11-20 17:07:32 +01:00
Martin Hořeňovský
ae1644e7e9
Add logical trait polyfills 2022-11-20 17:03:29 +01:00
Martin Hořeňovský
65cc7fd2ae
v3.2.0 2022-11-16 20:05:48 +01:00
Martin Hořeňovský
c276b530ee
Fix typo in docs/release-notes.md 2022-11-16 16:06:29 +01:00
Martin Hořeňovský
8beb74da8a
Add repeatability guarantees to faq.md 2022-11-16 11:21:00 +01:00
Tim Blechmann
e932bcf7a3 silence clang's -Wcomma 2022-11-14 13:06:52 +01:00
Martin Hořeňovský
6aa56c70e2
Mention BUILD.bazel in contributing docs for CATCH_CONFIG* 2022-11-12 22:08:23 +01:00
Rosen Penev
1cd86c09a2 meson: update minimum version
include_directories of type string began being supported in meson 0.50.0. New warning with meson 0.64
2022-11-12 14:32:01 +01:00
Emery Goss (AIVAS-v2:Ubuntu-20.04)
b980d408b1 Make MatcherGenericBase copy constructor take const parameter. 2022-11-12 12:22:35 +01:00
Vertexwahn
41990e0fe6
Fix Bazel build (#2563)
Also adds a CI job for Bazel build to avoid future breakage.
2022-11-11 16:54:22 +01:00
Robert Blaauboer
b65c0e27e9 Make ScopedMessage in INFO logging macro const
If users have const correctness checks enabled then this would flagged forcing users to wrap the INFO macro themselves or forego using it altogether.
2022-11-10 18:56:20 +01:00
Martin Hořeňovský
6e77e16ea8
Remove unused StringRef argument from MatchExpr
Apart from cleaning up the code, this change also improves the
compilation time of `UsageTests/Matchers.tests.cpp` by about 2%.
2022-11-10 15:25:51 +01:00
Martin Hořeňovský
943c6e3dee
Add version field to the XML reporter output
We start at version 2, with version 1 being taken up by the output
from Catch2 v2.
2022-11-10 12:04:51 +01:00
Martin Hořeňovský
066cc51ce6
Document adding new CATCH_CONFIG options to contributing.md 2022-11-09 16:33:47 +01:00
Masashi Fujita
b7f4a2efb8
Add support for PlayStation platforms (#2562)
* Add new `CATCH_CONFIG` option for using `std::getenv`, because PS does not support env vars
* Add PS to platforms that have disabled posix signals.
* Small workaround for PS toolchain bug that prevents it from compiling `std::set` with lambda based comparator.
2022-11-09 14:47:55 +01:00
Martin Hořeňovský
f8006aa6d4
More cleanups for src/CMakeLists.txt
* Sort source file lists
* Better source_group for cleanup in IDEs
* More uniform source lists
2022-11-09 13:12:42 +01:00
Martin Hořeňovský
fdea5a52c2
Improve the .clang-format file a bit
* add include sorting and grouping
* allow some short blocks to be on a single line
2022-11-07 23:14:29 +01:00
Martin Hořeňovský
297a17593f
Cleanup the helper scripts
* Remove from __future__ import print_function, because we
  no longer support Python2.
* Clean out unused parts of tools/scripts/scriptCommon.py
* Move appveyorMergeCoverageScript to Python3
* Update user reporting in *release scripts
* Cleanup module imports
2022-11-06 21:23:16 +01:00
Martin Hořeňovský
d1ef461471
Update basic cost estimates for approvals/benchmarks 2022-11-06 21:23:03 +01:00
Martin Hořeňovský
0c75caf77b
Don't write ApprovalTests' temporary files into the source tree
This has two effects:
 1) This significantly improves the performance of ApprovalTests
    run in WSL, because running the massively multi-reporter
    test would cause lots of small and parallel writes across the
    WSL-Windows FS boundary, completely mudering performance.

 2) ApprovalTests can be run from multiple build dirs in parallel,
    as long as they do not fail. However, if they do fail,
    the multiple runs will still step on each other toes when
    writing the unapproved files for user.
2022-11-06 00:11:38 +01:00
Martin Hořeňovský
3b139ae51a
Decomposer checks for 0 when assuming an int arg was 0 literal 2022-11-05 20:43:52 +01:00
Martin Hořeňovský
5f9d4ef331
Move throwing test failure exceptions into a helper 2022-11-05 00:22:45 +01:00
Martin Hořeňovský
ec59cd8736
Support decomposing types that only compare with literal 0
This is primarily done to support new `std::*_ordering` types,
but the refactoring also supports any other type with this
property.

The compilation overhead is surprisingly low. Testing it with
clang on a Linux machine, compiling our SelfTest project takes
only 2-3% longer with these changes than it takes otherwise.

Closes #2555
2022-11-04 19:24:44 +01:00
Martin Hořeňovský
d7f8c36e4c
Add traits for checking whether types are comparable 2022-11-04 19:24:42 +01:00
Martin Hořeňovský
b3dbd83da2
Add test for comparing pointers to NULL with != 2022-11-04 19:24:39 +01:00