Commit Graph

3856 Commits

Author SHA1 Message Date
Dimitrij Mijoski
86f86c4c23 Fix compiling with C++17 + Clang 5 + libstdc++ v5
This basically tests the combination where the compiler supports most
of C++17 but the library does not.
2021-05-26 00:34:23 +02:00
Martin Hořeňovský
023b5306b4
Add deep const to unique_ptr::operator-> 2021-05-19 11:00:53 +02:00
Martin Hořeňovský
9137e591fa
Cleanup and optimize stringifying of string-like types
More specifically, made the actual implementation of string-like
type handling take argument as `Catch::StringRef`, instead of
taking `std::string const&`.

This means that string-like types that are not `std::string` no
longer need to pay for an extra construction of `std::string`
(including the potential allocation), before they can be stringified.

The actual string stringification routine is now also better about
reserving sufficient space.
2021-05-18 23:15:22 +02:00
Martin Hořeňovský
f50a06affa
Small optimization for stringifying chrono::time_point 2021-05-18 00:17:34 +02:00
Martin Hořeňovský
4cc247cc70
Use constexpr StringRef instance for unprintable strings 2021-05-18 00:17:32 +02:00
Martin Hořeňovský
8ee422d6bf
Remove pointless branch from stringifying matcher assertions 2021-05-15 11:47:02 +02:00
Martin Hořeňovský
0c0f73a48d
Constexprify NameAndTags constructor 2021-05-15 00:02:09 +02:00
Martin Hořeňovský
61e16416a9
Pass other StringRef arguments by value instead of by-ref
Apart from being clearer, it also improves the overall codesize
of the implementation library, and should improve the performance
as well, by removing one level of indirection.
2021-05-14 23:45:59 +02:00
Martin Hořeňovský
074017f5ad
Inline MessageBuilder's constructor 2021-05-14 16:00:15 +02:00
Martin Hořeňovský
0a89e7f0c4
Pass StringRef by value instead of by const-ref 2021-05-14 15:59:42 +02:00
Martin Hořeňovský
28f6698ec8
Remove unneeded interface IRunner 2021-05-13 09:14:26 +02:00
Martin Hořeňovský
b36f8daaad
Clarify bunch of default, out of line destructors 2021-05-12 23:55:46 +02:00
Martin Hořeňovský
d86cb5f95d
Add override to virtual destructor of derived class 2021-05-12 23:23:02 +02:00
Martin Hořeňovský
5eb7aa4f90
Add test for dots in tag names 2021-05-12 21:43:14 +02:00
Martin Hořeňovský
35cba5486d
Remove mention of ANON_TEST_CASE from documentation
It was removed from v3, because the standard `TEST_CASE` can now be
anonymous as well.
2021-05-10 21:49:45 +02:00
Jozef Grajciar
eb911aa995
Suppress failure of CHECKED_IF and CHECKED_ELSE (#2187)
Resolves #1390

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2021-05-10 21:42:47 +02:00
Martin Hořeňovský
313071e8fe
Pick release notes for v2.13.6 2021-05-09 23:45:00 +02:00
Martin Hořeňovský
f9bb2668e4
Pick release notes for v2.13.5 2021-05-09 23:43:05 +02:00
Matteo Beniamino
baf0cd0be4
Fixed [dis]engage_platform declarations mismatch 2021-05-09 23:34:17 +02:00
Martin Hořeňovský
c0d0a50bdb
Significantly refactor fatal error handling
Because new glibc has changed `MINSIGSTKSZ` to be a syscall instead
of being constant, the signal posix handling needed changes, as it
used the value in constexpr context, for deciding size of an array.
It would be simple to fix it by having the handler determine the
signal handling stack size and allocate the memory every time the
handler is being installed, but that would add another allocation
and a syscall every time a test case is entered.

Instead, I split apart the idea of preparing fatal error handlers,
and engaging them, so that the memory can be allocated only once
and still be guarded by RAII.

Also turns out that Catch2's use of `MINSIGSTKSZ` was wrong, and
we should've been using `SIGSTKSZ` the whole time, which we use now.

Closes #2178
2021-05-09 23:34:15 +02:00
Pavel Kamenov
cbcab2dbcd
Add lcc to the list of unwanted compilers that mimic gcc 2021-05-09 18:12:58 +02:00
Scott Hutchinson
ea44e73961
Wrap all std::min and std::max calls in parentheses 2021-05-09 18:10:50 +02:00
Rob Boehne
d61fe3ecc3
[Issue 2154] Correct error when building with IBM's latest XLC (#2155)
* [Issue 2154] Correct error when building with IBM's latest XLC compiler with xlclang++ front-end.

On AIX, the XLC 16.1.0.1 compiler considers the call to `std::abs` ambigious, so it needs help with a static_cast to the type of the template argument.

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2021-05-09 18:05:39 +02:00
Tom de Geus
b325c6d81e
Making target detection on Mac more robust 2021-05-09 18:05:37 +02:00
Martin Hořeňovský
d4a3cd9992
Make the static library build reproducible with supported compilers
This is based on bed285af07 from
`v2.x` branch, but done properly for the build in v3 branch,
effectively porting #2141 to devel.
2021-05-09 18:05:34 +02:00
Martin Hořeňovský
342dd3445c
Pick documentation changes for 2.13.4 2021-05-09 18:05:31 +02:00
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