Commit Graph

4180 Commits

Author SHA1 Message Date
Martin Hořeňovský
23760327ae
Fix updateVersionPlaceholder when the placeholder starts the line 2021-05-09 18:05:27 +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
Sergio Losilla
cdf4748d1c
Modified hash to make it more independent of the choice of test names. 2021-05-09 18:05:14 +02:00
Martin Hořeňovský
520b6dace9
Remove conan to bintray packaging task from travis
As bintray is dead, it is no longer relevant and in fact, it will
fail during build.
2021-05-09 17:45:29 +02:00
Martin Hořeňovský
2cb5210caf
Fix and improve GitHub Actions CI
* Fixed problem with older compilers by explicitly installing the
  right compiler version.
* Split apart simple builds that can be well described by a build
  matrix, and builds that need special CMake defines or similar
  special snowflake handling.
* Ported some extras + examples builds from TravisCI to GitHub
  Actions.
2021-04-30 23:26:28 +02:00
Clare Macrae
2dc5a5f402
Prepare to prevent Catch2 v3's tests from being run, and CTest targets from being added, if Catch2 is configured as a sub-project. (#2205)
This commit fixes issue that happens if the project above us uses the same variable name, thus confusing our script which see the variable scoped from the project including Catch2, rather than ours

See #2202
2021-04-16 21:19:58 +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
Martin Hořeňovský
a5abec9cb5
Remove superfluous virtual from ExceptionTranslatorRegistry 2021-03-26 21:11:49 +01:00
Martin Hořeňovský
f1d7a10e06
Remove StringRef::isNullTerminated and StringRef::c_str
Both of them were fundamentally unsafe to use and shouldn't be used
at all.
2021-03-26 21:11:44 +01:00
Martin Hořeňovský
e50e10ef8f
Use std::string instead of StringRef as argument to the makeStream
This is done because `makeStream` was the only place using
`StringRef::c_str()`, which is an error-prone and unsafe API that
I want to remove.
2021-03-26 21:11:42 +01:00
Alexander Shaduri
2c269eb633 Fixed compilation under MinGW - use gmtime_s() instead of gmtime_r(). 2021-03-23 23:46:04 +01:00
Martin Hořeňovský
4b5812e932
Remove trailing whitespace from test-cases-and-sections.md 2021-03-23 13:02:24 +01:00
Martin Hořeňovský
9f44bd57f1
Add more documentation to BDD macros 2021-03-23 13:02:07 +01:00
matthew-limbinar
6734c0aa64
Expand documentation for BDD test macros (#2179) 2021-03-23 12:20:33 +01:00
Jozef Grajciar
037ddbc75c Fix introduced in version placeholders
Resolves #2082
2021-03-13 10:26:12 +01:00
Martin Hořeňovský
6d803cba5d
Add example of negated tag selection to the CLI test spec docs
Close #2180
2021-02-25 15:54:27 +01:00
Martin Hořeňovský
551946c45b
Split out INTERNAL_CATCH_UNIQUE_NAME into its own header
Also small cleanup of includes of related headers.
2021-02-24 23:14:18 +01:00
Martin Hořeňovský
653764d53b
Simplify workaround for MSVC issue with XmlWriter 2021-02-21 11:19:02 +01:00
Martin Hořeňovský
3afea8128a
Increase timing window for min duration tests to 1s
This test tends to be brittle on Mac CI machines, which are
heavily loaded and bursty. Since the tests are only run as part
of the "extra tests" test set, this increase should not have
a significant impact on the total duration of CI runs.
2021-02-20 23:09:02 +01:00
Martin Hořeňovský
749d953712
Add Clang 10 + C++17 build to linux CI 2021-02-20 22:26:22 +01:00
Martin Hořeňovský
4b50b13970
Disable C++ extensions for linux CI builds 2021-02-20 20:39:23 +01:00
Martin Hořeňovský
1ee0940427
Merge pull request #2177 from catchorg/devel-generating-surrogates
Add surrogate TUs option to CMake
2021-02-20 10:29:01 +01:00
Martin Hořeňovský
29050daec0
Add Linux and Windows CI builds with surrogate TUs 2021-02-19 23:23:00 +01:00
Martin Hořeňovský
e5e9afad16
Fix headers whose surrogate TUs did not compile 2021-02-19 23:22:43 +01:00
Martin Hořeňovský
8b27041fbe
Add CMake option to generate surrogate TUs in development build
A surrogate TU is TU that includes 1 specific header, and does
nothing else. This is useful to verify that the header is
self-sufficient and does not require other headers to be included
for compilation to succeed.

Closes #2106
Closes #2166 (this is a better solution)
2021-02-19 23:22:39 +01:00
Martin Hořeňovský
c12170ff69
Extend release notes
Included some changes that weren't updated at the time of merging,
and also results of a new runtime benchmark.
2021-02-13 15:34:38 +01:00
Rohit Goswami
3eade52fc0 users: Add d-SEAMS 2021-02-04 22:53:00 +01:00
Martin Hořeňovský
2dbe63a6ba
Merge pull request #2165 from catchorg/devel-gmtime-fixup
Use gmtime_r instead of gmtime when compiling for posixy platforms
2021-01-27 19:55:41 +01:00
Martin Hořeňovský
477540760a
Use gmtime_r instead of gmtime when compiling for posixy platforms 2021-01-27 11:49:52 +01:00
Martin Hořeňovský
b435e391c4
Merge pull request #2163 from catchorg/devel-list-outputs-to-out-flag
The output of --list-* flags obeys -o flag
2021-01-27 09:07:15 +01:00
Martin Hořeňovský
971b1fc32a
--list-* flags write to target specified by the -o flag
Also added tests for the default implementations of list* reporter
helpers.

Closes #2061
2021-01-26 18:36:54 +01:00
Martin Hořeňovský
6798c139a6
Extract the default listing implementation out of reporter interface
Also generalized the implementations to write to the provided
output stream, which will be required for the follow up changes,
where the listings should happen to the location user asked for
by specifying the `-o` flag.
2021-01-26 11:23:37 +01:00
Martin Hořeňovský
7111b2a8e2
Cleanup IStreamingReporter::listTests 2021-01-16 15:50:52 +01:00
Martin Hořeňovský
5509ceff60
Remove superfluous IConfig argument from IStreamingReporter::list*
The previous commit made it so that the `IConfig` is stored in
`IStreamingReporter` and thus always available.
2021-01-16 15:48:29 +01:00
Martin Hořeňovský
74f2f4ba5e
Hold reporter's IConfig instance in the interface
Previously, every base derived from the IStreamingReporter had
its own `IConfig const* m_config` member, so this just centralizes
the handling thereof.

Part of #2061
2021-01-16 15:27:56 +01:00
John Zimmermann
ba81505168 Do not match exact amount of spaces for errno macro expansion in approvalTests.py
E.g. musl libc expands errno() to __errno_location() without a space between, glibc has 1 space.
2021-01-08 11:31:28 +01:00
Martin Hořeňovský
f5b413aa58
Merge pull request #2138 from catchorg/devel-config-splitting
Split some configuration options out of catch_compiler_capabilities
2020-12-29 12:37:27 +01:00
Martin Hořeňovský
4e8832fc88
Split CATCH_CONFIG_COUNTER into its own header
Part of #2041
2020-12-29 11:07:45 +01:00
Martin Hořeňovský
bdd1e5c613
Remove some superfluous includes 2020-12-28 21:11:54 +01:00
Martin Hořeňovský
1d269211bd
Split CATCH_CONFIG_WCHAR into its own header
Part of #2041
2020-12-28 20:51:49 +01:00
Roman Proskuryakov
0acb371b92
Fix Wold-style-cast error (#2125)
* Add Wold-style-cast to cmake flags
* Fix old style cast in catch_stats.hpp
* Fix old style cast in catch_stats.cpp
2020-12-28 14:00:19 +01:00
Florian Berchtold
045feff834
Update cmake-integration.md (#2115)
* Update cmake-integration.md

CMake related, mainly more modern and provide an executable to be correct

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2020-12-28 13:41:55 +01:00
Martin Hořeňovský
965afc4b2e Split CATCH_CONFIG_ANDROID_LOGWRITE into its own header
Part of #2041
2020-12-28 12:53:52 +01:00
Martin Hořeňovský
77643ce2e5 Add more comprehensive tests for the quantifier matchers
This includes
* Testing both positive and negative path through the matchers
* Testing them with types whose `begin` and `end` member functions
require ADL
* Testing them with types that return different types from `begin`
and `end`
2020-12-27 20:20:55 +01:00
Uriel García Rivas
552af8920d Added AnyMatch, AllMatch and NoneMatch 2020-12-27 20:20:55 +01:00
Alex Voicu
ce54ec185f
Add the HIP CPU Runtime as a Catch2 user (#2123) 2020-12-18 13:23:17 +01:00
Martin Hořeňovský
c787b1edc9
Make Linux builds print stdout on ctest test failure 2020-12-15 09:58:19 +01:00
Martin Hořeňovský
a091853f4a
Rename file catch_matchers_floating -> catch_matchers_floating_point
The old name was a legacy of v2 era, where all headers were stitched
into one. With v3 using separate headers, it is better when they have
proper name.
2020-12-13 18:12:20 +01:00