Commit Graph

21 Commits

Author SHA1 Message Date
Martin Hořeňovský
f4af9f6926
Bump version to v3.0.0 preview 4 2022-01-03 23:16:39 +01:00
Martin Hořeňovský
e6da4e10ae
Use make_unique instead of unique_ptr(new T) 2021-06-01 00:17:22 +02:00
Martin Hořeňovský
f9ec34ce01
Make operator BenchmarkStats<Duration2> explicit 2021-05-28 23:19:07 +02:00
Reinhold Gschweicher
48f220b68a
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
2021-05-09 18:05:25 +02:00
Reinhold Gschweicher
031a57e7b7
Fix Catch.cmake helper by setting variable globally
Set `_CATCH_DISCOVER_TESTS_SCRIPT` helper variable globally. Otherwise in a
scoped call (like `add_subdirectory()`) the variable gets lost. This lost
variable results in a post build error with not much information to lead to the
root of the problem.

This enables the usage of the helper script with the following example structure

- CMakeLists.txt (project root with `add_subdirectory(external/catch2)`
- external/catch2
  - CMakeLists.txt (contents listed below)
  - contrib/Catch.cmake
  - contrib/CatchAddTests.cmake
  - catch2/catch.hpp
- tests
  - CMakeLists.txt (add tests with `catch_discover_tests(${PROJECT_NAME})`)

contents of project specific helper `external/catch2/CMakeLists.txt`
```cmake
cmake_minimum_required (VERSION 3.1...${CMAKE_VERSION})
project(Catch2 LANGUAGES CXX VERSION 2.13.3)
add_library(Catch2 INTERFACE)
target_include_directories(Catch2
  INTERFACE
    $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
)
 # provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
add_library(Catch2::Catch2 ALIAS Catch2)
include(contrib/Catch.cmake)
```
2021-05-09 18:05:18 +02:00
Georg Schwab
04166514fe fixed inconsistent semicolon expansion in catch_discover_tests (Bug #2214) 2021-04-16 17:22:14 +02:00
Julien Brianceau
e8cdfdca87
Fix typos in the code base (#2206)
Note that only documentation and comments are impacted by this change.
2021-04-07 20:43:50 +02:00
Reinhold Gschweicher
74b397e6b8
Consider CMP0110 add_test() policy
CMake 3.19 introduces new add_test() behavior guarded with the policy
CMP0110.

See: https://cmake.org/cmake/help/latest/policy/CMP0110.html

Update the helper script ParseAndAddCatchTests to consider the policy and
handle the test case name accordingly.
2020-11-02 14:42:22 +01:00
Reinhold Gschweicher
730ec39a74
Fix indentation in ParseAndAddCatchTests
Consistently use 4 spaces instead of tabs
2020-11-02 14:42:19 +01:00
Reinhold Gschweicher
71328bae90
Fix CMake regex to add tests
Fix regex that requires two string arguments in the form of
TEST_CASE("a", "b") resulting in not finding TEST_CASE("a") entries.

See https://regex101.com/r/JygOND/1

Fixes: https://github.com/catchorg/Catch2/issues/2055
2020-11-02 14:42:17 +01:00
Liam Keegan
c44d9cc718
fix warning in extras/CatchAddTests.cmake
- don't warn on zero return code of --list-reporters
  - previously return code was the number of reporters (#1410, #1146)
  - as of 2c06ee9 return code is zero on success
2020-10-08 16:44:20 +02:00
Martin Hořeňovský
b9853b4b35
Bump version to v3.0.0 preview 3 2020-10-08 15:26:30 +02:00
Rémy Salim
863cc6a155
Add WORKING_DIRECTORY to CatchAddTests.cmake commands 2020-10-08 11:41:35 +02:00
Ansel Sermersheim
1d01464730
Support template test cases in ParseAndAddCatchTests
* Change regex to allow parentheses inside the test macro for a type list
* Append a wildcard to the CTestName if the test case is a template
* Also change the regular expression so parentheses are allowed in names
  (fixes #1848)
2020-10-08 11:37:11 +02:00
Martin Stump
c522e88afa
Add REPORTER and OUTPUT_* args 2020-10-08 11:35:42 +02:00
Martin Hořeňovský
60dfec559f
Provide 1 .hpp + 1 .cpp distribution of Catch2
This commits also adds a script that does the amalgamation of headers
and .cpp files into the distributable version, removes the old
`generateSingleHeader` script, and also adds a very simple compilation
test for the amalgamated distribution.
2020-09-09 13:02:50 +02:00
Karthik Nishanth
2c1c02f7e7
Update ParseAndAddCatchTests.cmake 2020-09-07 13:00:55 +02:00
Reinhold Gschweicher
95c0c88d84
Fix CMake add test helper for CMake 3.18.0
With CMake 3.18.0 the `add_test(NAME)` handling changed. The escaped
double quotes confuse the new call. Work around this upstream change.

fixes: https://github.com/catchorg/Catch2/issues/1984
2020-07-26 15:15:50 +02:00
Martin Hořeňovský
964303706a
Fixup catch_discover_tests
Fixed its use of removed `--list-test-names-only` switch, and also
updated the return code check to reflect changes in v3.

Closes #1933
2020-05-20 07:14:06 +02:00
Invincible
8ea45bf50c
Change PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME conditional.
When no TEST_CASE_METHOD function, there is no fixture to get.
2020-05-01 09:30:31 +02:00
Martin Hořeňovský
918aa327fa
Rename contrib/ to extras/ 2019-12-05 16:24:57 +01:00