diff options
| author | Reinhold Gschweicher | 2020-12-17 14:02:48 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-05-09 18:05:25 +0200 |
| commit | 48f220b68a7ce43846be19ec6db46ede5e5e5ae2 (patch) | |
| tree | a4d80be7a8efcc3b9de35886286604ad6209a878 /docs | |
| parent | 031a57e7b719dce26119ac8547f167190234a763 (diff) | |
| download | catch3-48f220b68a7ce43846be19ec6db46ede5e5e5ae2.tar.gz | |
Add deprecation warning in ParseAndCatchTests
Parsing C++ with regex in CMake is error prone and regularly leads to silently
dropped (not run) test cases.
Going forward the function `catch_discover_tests` from `contrib/CMake.cmake`
should be used.
For more information see https://github.com/catchorg/Catch2/issues/2092#issuecomment-747342765
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/cmake-integration.md | 11 | ||||
| -rw-r--r-- | docs/deprecations.md | 7 |
2 files changed, 16 insertions, 2 deletions
diff --git a/docs/cmake-integration.md b/docs/cmake-integration.md index 59e06842..66772d45 100644 --- a/docs/cmake-integration.md +++ b/docs/cmake-integration.md @@ -60,7 +60,7 @@ with automatically registering their `TEST_CASE`s with CTest. They can be found in the `extras` folder, and are 1) `Catch.cmake` (and its dependency `CatchAddTests.cmake`) -2) `ParseAndAddCatchTests.cmake` +2) `ParseAndAddCatchTests.cmake` (deprecated) If Catch2 has been installed in system, both of these can be used after doing `find_package(Catch2 REQUIRED)`. Otherwise you need to add them @@ -179,10 +179,17 @@ the output file name e.g. ".xml". ### `ParseAndAddCatchTests.cmake` +⚠ This script is [deprecated](https://github.com/catchorg/Catch2/pull/2120) +in Catch X.Y.Z and superseded by the above approach using `catch_discover_tests`. +See [#2092](https://github.com/catchorg/Catch2/issues/2092) for details. + `ParseAndAddCatchTests` works by parsing all implementation files associated with the provided target, and registering them via CTest's `add_test`. This approach has some limitations, such as the fact that -commented-out tests will be registered anyway. +commented-out tests will be registered anyway. More serious, only a +subset of the assertion macros currently available in Catch can be +detected by this script and tests with any macros that cannot be +parsed are *silently ignored*. #### Usage diff --git a/docs/deprecations.md b/docs/deprecations.md index c0e51b46..0649e447 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -9,6 +9,13 @@ either of these is a breaking change, and thus will not happen until at least the next major release. +### `ParseAndAddCatchTests.cmake` + +The CMake/CTest integration using `ParseAndAddCatchTests.cmake` is deprecated, +as it can be replaced by `Catch.cmake` that provides the function +`catch_discover_tests` to get tests directly from a CMake target via the +command line interface instead of parsing C++ code with regular expressions. + ## Planned changes |