Releases: catchorg/Catch2
Releases · catchorg/Catch2
v2.0.1
This is the first full release of Catch2. There may be some minor breaking changes for some people. Please see the details below before moving to this release. If you need to stay on Catch "Classic", because you do not have a fully C++11 aware compiler, for example, then please see the Catch1.x branch.
The following list is changes compared to Catch 1.x:
Breaking changes
- Removed C++98 support
- Removed legacy reporter support
- Removed legacy generator support
- Generator support will come back later, reworked
- Removed
Catch::toString
support- The new stringification machinery uses
Catch::StringMaker
specializations first andoperator<<
overloads second.
- The new stringification machinery uses
- Removed legacy
SCOPED_MSG
andSCOPED_INFO
macros - Removed
INTERNAL_CATCH_REGISTER_REPORTER
CATCH_REGISTER_REPORTER
should be used to register reporters
- Removed legacy
[hide]
tag[.]
,[.foo]
and[!hide]
are still supported
- Output into debugger is now colourized
*_THROWS_AS(expr, exception_type)
now unconditionally appendsconst&
to the exception type.CATCH_CONFIG_FAST_COMPILE
now affects theCHECK_
family of assertions as well asREQUIRE_
family of assertions- This is most noticeable in
CHECK(throws())
, which would previously report failure, properly stringify the exception and continue. Now it will report failure and stop executing current section.
- This is most noticeable in
- Removed deprecated matcher utility functions
Not
,AllOf
andAnyOf
.- They are superseded by operators
!
,&&
and||
, which are natural and do not have limited arity
- They are superseded by operators
- Removed support for non-const comparison operators
- Non-const comparison operators are an abomination that should not exist
- They were breaking support for comparing function to function pointer
std::pair
andstd::tuple
are no longer stringified by default- This is done to avoid dragging in
<tuple>
and<utility>
headers in common path - Their stringification can be enabled per-file via new configuration macros
- This is done to avoid dragging in
Approx
is subtly different and hopefully behaves more as users would expectApprox::scale
defaults to0.0
Approx::epsilon
no longer applies to the larger of the two compared values, but only to theApprox
's valueINFINITY == Approx(INFINITY)
returns true
Improvements
- Reporters and Listeners can be defined in files different from the main file
- The file has to define
CATCH_CONFIG_EXTERNAL_INTERFACES
before including catch.hpp.
- The file has to define
- Errors that happen during set up before main are now caught and properly reported once main is entered
- If you are providing your own main, you can access and use these as well.
- New assertion macros, *_THROWS_MATCHES(expr, exception_type, matcher) are provided
- As the arguments suggest, these allow you to assert that an expression throws desired type of exception and pass the exception to a matcher.
- JUnit reporter no longer has significantly different output for test cases with and without sections
- Most assertions now support expressions containing commas (ie
REQUIRE(foo() == std::vector<int>{1, 2, 3});
) - Catch now contains experimental micro benchmarking support
- See
projects/SelfTest/Benchmark.tests.cpp
for examples - The support being experiment means that it can be changed without prior notice
- See
- Catch uses new CLI parsing library (Clara)
- Users can now easily add new command line options to the final executable
- This also leads to some changes in
Catch::Session
interface
- All parts of matchers can be removed from a TU by defining
CATCH_CONFIG_DISABLE_MATCHERS
- This can be used to somewhat speed up compilation times
- An experimental implementation of
CATCH_CONFIG_DISABLE
has been added- Inspired by Doctest's
DOCTEST_CONFIG_DISABLE
- Useful for implementing tests in source files
- ie for functions in anonymous namespaces
- Removes all assertions
- Prevents
TEST_CASE
registrations - Exception translators are not registered
- Reporters are not registered
- Listeners are not registered
- Inspired by Doctest's
- Reporters/Listeners are now notified of fatal errors
- This means specific signals or structured exceptions
- The Reporter/Listener interface provides default, empty, implementation to preserve backward compatibility
- Stringification of
std::chrono::duration
andstd::chrono::time_point
is now supported- Needs to be enabled by a per-file compile time configuration option
- Add
pkg-config
support to CMake install command
Fixes
- Don't use console colour if running in XCode
- Explicit constructor in reporter base class
- Swept out
-Wweak-vtables
,-Wexit-time-destructors
,-Wglobal-constructors
warnings - Compilation for Universal Windows Platform (UWP) is supported
- SEH handling and colorized output are disabled when compiling for UWP
- Implemented a workaround for
std::uncaught_exception
issues in libcxxrt- These issues caused incorrect section traversals
- The workaround is only partial, user's test can still trigger the issue by using
throw;
to rethrow an exception
- Suppressed C4061 warning under MSVC
Internal changes
- The development version now uses .cpp files instead of header files containing implementation.
- This makes partial rebuilds much faster during development
- The expression decomposition layer has been rewritten
- The evaluation layer has been rewritten
- New library (TextFlow) is used for formatting text to output
v1.11.0
1.11.0
Fixes
- The original expression in
REQUIRE_FALSE( expr )
is now reporter properly as!( expr )
(#1051)- Previously the parentheses were missing and
x != y
would be expanded as!x != x
- Previously the parentheses were missing and
Approx::Margin
is now inclusive (#952)- Previously it was meant and documented as inclusive, but the check itself wasn't
- This means that
REQUIRE( 0.25f == Approx( 0.0f ).margin( 0.25f ) )
passes, instead of fails
RandomNumberGenerator::result_type
is now unsigned (#1050)
Improvements
__JETBRAINS_IDE__
macro handling is now CLion version specific (#1017)- When CLion 2017.3 or newer is detected,
__COUNTER__
is used instead of
- When CLion 2017.3 or newer is detected,
- TeamCity reporter now explicitly flushes output stream after each report (#1057)
- On some platforms, output from redirected streams would show up only after the tests finished running
ParseAndAddCatchTests
now can add test files as dependency to CMake configuration- This means you do not have to manually rerun CMake configuration step to detect new tests
V2.0.0-develop.6
Improvements
- Add
pkg-config
support to CMake install
Fixes
- More usages of
min
andmax
are enclosed in parentheses to solve MFC macro issues (#1034) - Bitfield capture now compiles (#1027)
- Expansion of
*_FALSE
now properly parenthesises original expression - Removed mismatch between
pragma warning(push)
andpragma warning(pop)
in single include - Suppressed
C4601
inside Catch - We now check if
WINAPI_FAMILY
is defined before using it to detect UWP build - Paths prefixed with '/' are parsed properly
V2.0.0-develop.5
Improvements
- Added stringification for std::chrono::{duration,time_point}
Fixes
- fixed benchmarks when using multiple reporters (which happens when you register a listener).
- fixed command line parser (Clara) to report unrecognised options again
- fixed single include for MSVC (#1020)
- (partial) workaround for long-standing bug in some compilers' support for uncaught_exception() (#1028)
v2.0.0-develop.4
Improvements
- More warnings are silenced
- Don't use console colour if running in XCode
- More compile time optimisations
Fixes
- CATCH_CONFIG_FAST_COMPILE now now builds again
- explicit constructor in reporter base class
- Many fixes for building in Objective-C context
- Fixed text formatting with multiple consecutive newlines (from Clara)
Breaking changes
- Removed deprecated matcher utility functions
Not
,AllOf
andAnyOf
.- They are superseded by operators
!
,&&
and||
, which are natural and do not have limited arity
- They are superseded by operators
- No longer accept non-const comparison operators
v2.0.0-develop.3
Fixes
- Fixed compilation error when comparing a pointer to long
NULL
- Fixed missing platform detection when
CATCH_CONFIG_FAST_COMPILE
was used - Silenced unused return value warning in
wait-for-keypress
option - Enabled workaround for VS2017 issue with raw string literals in assertions
Improvements
- Added
CATCH_CONFIG_DISABLE
compile-time toggle inspired by Doctest- Assertions are turned into no-ops
TEST_CASE
s are not registered- Exception translators are not registered
- Reporters are not registered
- Listeners are not registered
- Further improvements are coming
REGISTER_TEST_CASE
can be now used in global scope to provide automatic registration of test function
Breaking changes
- Removed legacy
[hide]
tag[!hide]
,[.]
and[.foo]
are kept
v1.10.0
1.10.0
Fixes
- Evaluation layer has been rewritten (backported from Catch 2)
- The new layer is much simpler and fixes some issues (#981)
- Implemented workaround for VS 2017 raw string literal stringification bug (#995)
- Fixed interaction between
[!shouldfail]
and[!mayfail]
tags and sections- Previously sections with failing assertions would be marked as failed, not failed-but-ok
Improvements
- Added libidentify support
- Added "wait-for-keypress" option
v2.0.0-develop.2
Fixes
- fixed issue when comparing non-copyable values
- fixed issue with exception message checking with matchers
Features
- introduced
CATCH_CONFIG_EXTERNAL_INTERFACES
so that, e.g., reporters can be implemented outside the main file.
Breaking changes
- reverted
-d
syntax to previous behaviour (so it takes an argument again,yes
orno
). - removed deprecated
INTERNAL_CATCH_REGISTER_LISTENER
(useCATCH_REGISTER_LISTENER
)
v2.0.0-develop.1
2.0.0-develop.1
This is the first beta release of Catch2, which rebases on C++11.
It includes many changes - some breaking - including:
Internal
- Migrated lots of code to C++11 and removed most compatibility workarounds
- Reworked expression decomposition layer - now much simpler and less code
- Added, and started using in some places, a
StringRef
, which is similar to C++17'sstring_view
- Use new, rewritten, version of Clara (for command line parsing)
- Use new, rewritten, text formatting sub-lib, TextFlow.
- Full project now has .cpp files instead of headers with implementation - still merged down to a single header.
- Lots of other fixes and tweaks
Features
- Can now use commas in assertion macros (e.g. when using template argument lists)
- Command line can now be easily extended (as Clara has a composable interface)
- Experimental micro-benchmarking support added
Breaking
- Removed
Catch::toString()
- you must now specialiseCatch::StringMaker<>
instead -d
command line option no longer takes an argument- Removed old, experimental, generators support (new version will be coming)
- Changed interface of
Catch::Session
as it relates to Clara - in particular removedunusedTokens()
, theunusedOptionBehaviour
argument fromapplyCommandLine()
and changed the type thatcli()
returns. - Removed redundant
SCOPED_MSG
andSCOPED_CAPTURE
v1.9.7
1.9.7
Fixes
- Various warnings from clang-tidy, Resharper-C++ and PVS Studio have been addressed (#957)
- Dynamically generated sections are now properly reported (#963)
- Writes to
std::clog
are redirected for reporters (#989)- Previously only
std::cerr
writes were redirected - Interleaved writes to
std::cerr
andstd::clog
are combined properly
- Previously only
- Assertions failed before signals/structured exceptions fails test case are properly reported as failed (#990)
Improvements
- Catch's runtime overhead has been decreased further (#940)
- Added support for IBM i ILE c++ compiler (#976)
- This means that AS/400 is now supported.
- The default reporter can be configured at compile time (#978)
- That is, the reporter used if no reporter is explicitly specified
Other
ParseAndAddCatchTests
cmake script has couple new customization options