Repository navigation
Releases
Releases · catchorg/Catch2
v3.16.1
Fixes
- Fixed optimizations being disabled after including benchmarking headers under MSVC. (#3212)
- This was introduced in 3.16.0's fix for the deopt implementation for MSVC never being used.
- Fixed Console reporter replacing
\0xFFs in user-provided strings. - Added missing
<cassert>include tocatch_generators_range.hpp. (#3205)
Improvements
- Workaround for GCC's quadratic scaling for release builds with number of test cases.
- In practice the improvement is only noticeable with unity builds and/or template product tests.
- Changed how decomposer operators are defined for better compilation times.
- For Catch2's
SelfTestbinary, this provides ~2% build time improvement.
- For Catch2's
- Changed how decomposer handles stringification for smaller binary sizes.
- For the
SelfTestbinary this is about ~8%.
- For the
- Improved compilation costs of multiple assertions in one test cases for release builds.
- Optimized initial test registration at process start:
- Fewer allocations for test cases with many tags.
- Faster processing for test cases with <=2 tags.
- Faster tag validation.
- Faster checking for duplicated test cases.
- Optimized test selection and filtering:
- Optimized filtering tests by test name.
- Running
SelfTestwithabc*as the filter pattern is ~10% faster.
- Running
Miscellaneous
catch_discover_testsregisters individual tests with--order declfor faster startup.- For
SelfTest, this provides 20% improvement in Debug and 5% in Release builds.
- For
CMakeConfig::family of tests use the main build's toolchain file. (#3202)- Deprecated throwing exceptions from the reporter interface functions.
- Previously, throwing from e.g.
assertionEndedmight, or might not, have worked depending on which assertion has ended. As it is not practical for Catch2 to guard against the reporters failing randomly, and marking so withnoexceptcan provide compilation throughput improvements, I decided to fully forbid it. - Reporter constructors are allowed to throw and the test binary will report the error nicely before exiting.
- Due to C++ limitations, this deprecation cannot be marked inside the code, only in docs.
- Previously, throwing from e.g.
v3.16.0
Fixes
- Multiple fixes in
catch_discover_tests:- Fixed
<target>_TESTSvariable accumulating JSON fragments alongside test names.- This was introduced during the refactoring in last release.
- Fixed
<target>_TESTSvariable fromcatch_discover_testsnot escaping test names to be properly parsed by CMake.- This means that e.g. test names with semicolons will not be split into multiple partial test names.
- This bug has existed since the first version of the script.
- Fixed
TEST_PREFIX/TEST_SUFFIXargs having leading/trailing whitespace stripped.
- Fixed
- Added workaround for Clang 20-21 compile error with
TEMPLATE_PRODUCT_TEST_CASE(#3115, #3173)
Improvements
- Verbosity option is now handled per reporter.
- The standalone
--verbosityflag is propagated to all reporters as default, just like--colour-mode.
- The standalone
- The JSON reporter considers verbosity when listing tests.
- Another set of performance improvements for
catch_discover_testsperformance- The newest version can register about 3k tests in 1 second, up from 1k previously.
- The initial
TEST_CASEregistration is slightly faster. - Reduced overhead from first instantiating
BENCHMARKmachinery in a TU. - Improved compilation speed when multiple templated test case macros use the same types.
- Rewrote implementation of the string matchers
- Case-sensitive matching (the default) is significantly faster.
- Case-insensitive matching is faster in most cases.
- Added optimizer barrier to calls into benchmarks without return values
- This limits the optimizations compiler can perform between calls into the benchmarked function, improving the accuracy.
- Added warning that checks for using sharding without deterministic test order (#3186)
v3.15.3
Fixes
- The JSON reporter's number handling is locale-independent. (#3176)
- Removed leftover debug message from
catch_discover_tests(#3177) - Fixed typo in the "Could not jump to the Nth element" exception message (#3181)
Improvements
catch_discover_testsregisters tests in deterministic (alphabetical) order.catch_discover_testshas been rewritten to be massively faster.- Preparing the actual CTest script is significantly faster.
- Parsing the JSON test array is significantly faster.
- Running without
ADD_TAGS_AS_LABELSset is 10-15% faster (as opposed to being the same speed) (#3169) - The new implementation is about 4x-5x faster, so registering 500 tests now takes ~350ms (down from 1.1s).
- JSON writing is faster
- Small improvement in writing non-string values
- ~6-40% improvement in writing string values that do not need escaping
- ~1-6% improvement in writing string values that do need escaping
- Better support for infs and NaNs in JSON output
v3.15.2
Fixes
- Fixed
--warn InfiniteGeneratorstriggering even if the generator was limited to specific element via path filtering. - Fixed
-Wunused-parametertriggering in-fnoexceptionsbuilds.
Improvements
catch_discover_testscan handle cases where the binary prints out non-Catch2 output due to global constructors (#3162)
v3.15.1
v3.15.0
Fixes
- Fixed ambiguous overload issue with
std::optional<T>in C++26. (#3095)- Since
std::optionalwas turned into a range, the partial specialization ofStringMakerfor range-like types and forstd::optional<T>were in conflict.
- Since
Improvements
- Simplified
CATCH_REGISTER_ENUMinternals for faster compilation and retrieval. - Successful assertion are slightly (1-2%) faster.
- Generic (new-style) matchers support constexpr matching in C++20.
- Combining matchers requires C++26.
- Catch2-provided generic matchers are all constexpr enabled.
- Added
STATIC_REQUIRE_THATfor compile-time matcher assertions.- This requires the compiler to support enough
constexprfor matchers, see above.
- This requires the compiler to support enough
v3.14.0
Fixes
- Added missing
<cstdint>includes. (#3078) - Fixed suppression of empty variadic macro arguments warning on Clang <19. (#3085)
- Fixed
catch_discover_testsfailing duringPRE_TESTdiscovery if a target does not have discoverable tests. (#3075) - Fixed build of the main library failing with
CATCH_CONFIG_PREFIX_ALLdefined. (#3087) - JUnit reporter outputs single failed (errored/skipped) assertion per test case. (#1919)
Improvements
- The default implementation of
--list-tagsand--list-listenershas a quiet variant. - Suppressed the new Clang warning about
__COUNTER__usage. (#3076) - Line-wrapping counts utf-8 codepoints instead of bytes. (#1022, #3086)
- Combining character sequences are still miscounted, but Catch2 does not aim to fully support Unicode.
v3.13.0
Fixes
--benchmark-samples 0no longer hard crashes (#3056)- The CLI validation fails instead.
- Fixed warning suppression macros being doubly defined when using Clang on Windows (#3060)
Improvements
- Suppressed static analysis 26426 diagnostic for MSVC (#3057)
- Renamed the internal deprecation macro from
DEPRECATEDtoCATCH_DEPRECATEDto avoid conflicts (#3058) - Added
UNSCOPED_CAPTUREmacro (#2954) - Added
ConcatGeneratorto combine multiple separate generator into one- The short form is
cat
- The short form is
- Generators can now jump forward to nth element efficiently
- Custom generators that can jump forward efficiently should override
skipToNthElementImpl
- Custom generators that can jump forward efficiently should override
- Generators can declare themselves infinite
- The generator base defaults to declaring itself finite for backwards compatibility
- Custom generators should override
isFinite()to return the proper value
- Added
--warn InfiniteGeneratorsto error out onGENERATEbeing given an infinite generator - Extended options for section filtering from CLI to include generators
- The user can specify which element from the generator to use in the test case
- See documentation for how the new filters work and how they can be specified
MapGeneratoronly calls the mapping function if the output will be used
v3.12.0
Fixes
- Fixed unscoped messages after a passing fast-pathed assertion being lost.
- Fixed the help string for
--orderto mention random order as the default. (#3045) - Fixed small documentation typos. (#3039)
- Fixed compilation with
CATCH_CONFIG_THREAD_SAFE_ASSERTIONSfor older C++ standards. - Fixed a thread-safety issue with message macros being used too early after the process starts.
- Fixed automatic configuration to properly handle PlayStation platform. (#3054)
- Fixed the weird behaviour of section filtering when specifying multiple filters. (#3038)
- See #3038 for more details.
Improvements
- Added
lifetimeboundattribute to various places.- As an example, compiler that supports lifetime analysis will now diagnose invalid use of Matcher combinators.
- Minor compile-time improvements to stringification. (#3028)
std::tupleprinter does not recurse.- Some implementation details were outlined into the cpp file.
- Global variables will only be marked with
thread_localin thread-safe builds. (#3044)
Miscellaneous
- The thread safety support is no longer experimental.
- The new CMake option and C++ define is now
CATCH_CONFIG_THREAD_SAFE_ASSERTIONS.
- The new CMake option and C++ define is now
v3.11.0
Fixes
- Fixed building on non-desktop GDK platforms (#3029)
- Fixed message macros being susceptible to race in specific scenario (#3031)
- Catch2's SEH filter will call the previously installed filter after reporting the error (#3033)
Improvements
- Handling of scoped messages (e.g.
CAPTURE) is a bit faster. - Better out-of-the-box support for QNX (#2953)
- Improved performance of assertions by up-to 10%
- Release mode assertion fast-path sees the biggest improvement.
- Faster processing of non-escaped strings in
--invisiblesmode. - Added support for Bazel's
TEST_RANDOM_SEEDenv var (#3021) - Added support for Bazel's
TEST_PREMATURE_EXIT_FILEenv var (#3020)- This creates a file that is deleted if the tests exit normally, but stays around if the process dies unexpectedly.
- This functionality is also exposed through CLI as
--premature-exit-guard-file
Miscellaneous
- Tuple.app has sponsored Catch2