Commit Graph

62 Commits

Author SHA1 Message Date
Martin Hořeňovský cf6575576f
Start fixing up Matchers: namespaces, composition ops
This commit also forbids composing lvalues of composed matchers, as
per previous deprecation notice. I do not expect this to be contentious
in practice, because there was a bug in that usage for years, and
nobody complained.
2020-02-20 13:03:30 +01:00
Martin Hořeňovský ae1d21315c
Specialize CATCH_TRAP() for iOS + thumb instruction set combo
Fixes #1862
2020-02-16 16:11:29 +01:00
Tristan Stenner 6a2c025bfc
Add command line option 'never' to --wait-for-keypress (#1866)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2020-02-16 16:11:11 +01:00
Martin Hořeňovský f8794634c2
Fix significant bug with storing composed matchers
Given that in the 2 or so years that matchers are thing nobody complained,
it seems that people do not actually write this sort of code, and the
possibility will be removed in v3. However, to avoid correctness bugs,
we will have to support this weird code in v2.
2020-02-16 16:02:31 +01:00
Martin Hořeňovský d6b2a3793b
Check for Windows instead of WIN32 for wmain entry point
Closes #1849
2020-02-16 15:54:24 +01:00
Martin Hořeňovský 548de655fd
Cleanup nextafter workaround 2020-02-16 15:52:14 +01:00
khyperia 3c7e737a7b
Allow configuring of benchmark warmup time 2020-02-16 15:44:23 +01:00
khyperia e880da93bd
Make CATCH_BREAK_INTO_DEBUGGER be user-configurable 2020-02-16 15:27:21 +01:00
Rosen Penev 3e01d4b239
catch_compiler_capabilities.h: use proper math define
C++11 math requires _GLIBCXX_USE_C99_MATH_TR1 to be true with gcc/clang.

Also fixes an issue with uClibc-ng where __UCLIBC__ is defined in features.h but
that is not included here and is thus no-op.
2020-02-16 15:27:04 +01:00
offa 06c32862b3
Some refactorings:
- Overrides added
 - usages of push_back() replaced with emplace_back()
 - Loop variable made const-refernce
 - NULL replaced with nullptr
 - Names used in the declaration and definition unified
 - size() replaced with empty
 - Identical cases merged
2020-02-16 15:25:23 +01:00
Daniel Griscom ab520f4e97
Removed unneeded 'using uchar = unsigned char' 2020-02-16 15:12:07 +01:00
melak47 17c4b2d093
Feature: generic matchers (#1843)
This commit extends the Matchers feature with the ability to have type-independent (e.g. templated) matchers. This is done by adding a new base type that Matchers can extend, `MatcherGenericBase`, and overloads of operators `!`, `&&` and `||` that handle matchers extending `MatcherGenericBase` in a special manner.

These new matchers can also take their arguments as values and non-const references.

Closes #1307 
Closes #1553 
Closes #1554 

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2020-02-16 11:19:10 +01:00
Martin Hořeňovský db1a0465dc
Outline GeneratorException from generators header 2020-02-14 16:15:47 +01:00
Martin Hořeňovský b009d190bf
Avoid detecting Clang as having MSVC's traditional preprocessor
Fixes #1806
2020-02-13 16:28:30 +01:00
ptc-tgamper ac83087bc2
catch_debugger.h - implement break into debugger assembler instructions for iOS 2020-02-13 16:28:02 +01:00
ptc-tgamper 123b449f8d
catch_console_colour.cpp - adjust useColourOnPlatform for iOS 2020-02-13 16:27:56 +01:00
ptc-tgamper 6ad743a62b
catch_debugger.cpp - debugger detection is identical on Mac OS X and iOS 2020-02-13 16:27:46 +01:00
Martin Hořeňovský 0f47fe16bd
Provide const overload of ObjectStorage::stored_object()
Fixes #1820
2020-02-13 16:26:06 +01:00
Joe Burzinski 82baef62e2
Fix forwarding in SingleValueGenerator and generator creation
Fixes #1809
2020-02-13 16:19:50 +01:00
Joe Burzinski 0fbf4f3e15
Fix wrong namespacing of benchmarking constructor helpers 2020-02-13 16:15:50 +01:00
Martin Hořeňovský ad3f50bbc1
Suppress using-namespace lint in GENERATE* macros
Closes #1799
2020-02-13 15:31:09 +01:00
Martin Hořeňovský 2945b80f61
Add more constexpr to StringRef 2020-02-13 15:01:03 +01:00
Martin Hořeňovský c50ba09cde
Split [.foo] into [.][foo] when parsing test specs
b77cec05c0 fixed this problem for tagging tests, so that a test
case tagged with `[.foo]` would be parsed as tagged with `[.][foo]`.
This does the same for the test spec parsing.

Fixes #1798
2020-02-13 13:35:10 +01:00
Martin Hořeňovský c165bd15c5
Forbid copying ReusableStringStream
Copying a `ReusableStringStream` would lead to "double free" of
the stream, and thus it could be used in multiple places at the
same time, breaking the output.
2020-02-12 19:21:15 +01:00
cericks0n 4f0de7bbad
Fix error when period of steady_clock is not nano
On systems where std::chrono::steady_clock::period is not std::nano, benchmark tests fail to compile due to trying to convert analysis.samples from a vector of duration<double, clock::period> to a vector of std::chrono::duration<double, std::nano>.
2020-02-12 19:20:41 +01:00
Martin Hořeňovský 21b24e8326
Remove catch_external_interfaces.h
Its intent was to show which headers are expected to be useable by
Catch2's users, and to enforce their inclusion in the single header
distribution at the right place.

Given the new library model, the second use case is not needed and
the first one is better served with documentation and physical file
layout.
2020-02-12 16:57:15 +01:00
Martin Hořeňovský 0b2874b6b1
Move SonarQube reporter implementation to a cpp file 2020-02-07 11:26:33 +01:00
Martin Hořeňovský e6ea53ab49
Move Automake reporter to a cpp file 2020-02-07 11:26:30 +01:00
Martin Hořeňovský 338572a4f7
Move TAP reporter implementation to a cpp file 2020-02-07 11:26:28 +01:00
Martin Hořeňovský 70836d49ba
Move include of catch_enforce out of the reporter bases 2020-02-07 11:26:24 +01:00
Martin Hořeňovský db148c42d7
Move TeamCity implementation to a cpp file 2020-02-07 11:26:21 +01:00
Martin Hořeňovský cd7d7a1c67
Remove CATCH_CONFIG_ENABLE_BENCHMARKING compilation toggle
Now that Catch2 is a proper library, we can always build the full
library (comparatively minor slowdown) and the user can avoid
including benchmarking headers to avoid the compilation slowdown.
2020-02-06 11:36:46 +01:00
Martin Hořeňovský bce5b364d3
Unconditionally provide <chrono> StringMakers 2020-02-03 20:53:36 +01:00
Martin Hořeňovský c3a5e21648
Move Approx out of the Detail namespace 2020-02-03 15:14:59 +01:00
offa bd9520c0f9 GCC pragma fixed. 2020-02-03 09:27:34 +01:00
Martin Hořeňovský 3b297cf9b5
Outline Config destructor to avoid including superfluous header 2020-02-02 14:43:26 +01:00
Martin Hořeňovský 66fe591477
Replace C++11 use of ::type with the _t suffix for std traits 2020-02-02 12:59:19 +01:00
Martin Hořeňovský ea6db67063
Use std::make_unique instead of our polyfill or naked new
The use we previously used the polyfill or naked new is that we
supported C++11, which did not yet have `std::make_unique`. However,
with the move to C++14 as the minimum, `std::make_unique` can be
expected to be always available.
2020-02-01 23:34:00 +01:00
Martin Hořeňovský ddd0e7218d
Remove the !hide special tag 2020-01-28 20:48:32 +01:00
Martin Hořeňovský d0257fc1ff
Do not use shared_ptrs for filters and patterns 2020-01-25 20:39:17 +01:00
Martin Hořeňovský df2379218b
Reduce the use of shared_ptrs for various Config objects
Ideally they would not be used at all, but the main config lifetime
is a weird mess right now and will require further refactoring.
2020-01-25 17:41:38 +01:00
Martin Hořeňovský 7134ad9913
Replace shared_ptr with unique_ptr for reporters 2020-01-25 14:07:29 +01:00
Martin Hořeňovský 2f4a7dda68
Have the in-development version report as v3.0.0
Because some of the tooling used by Catch2 does not properly support
version postfixes, such as `preview-1`, we will report the
in-development version is `v3.0.0`, and the first real release will
have to be `v3.0.1`.

Closes #1824
2020-01-25 09:15:46 +01:00
Martin Hořeňovský 6c3a5ef625
Remove CATCH_CONFIG_DISABLE_MATCHERS
Now that the recommended distribution and usage method is proper
library, users can just avoid including the matcher headers to get
basically the same effect.
2020-01-25 09:07:36 +01:00
Martin Hořeňovský 26f78f96aa
Start using piecemeal includes in test files 2020-01-21 10:03:54 +01:00
Martin Hořeňovský c381b49c60
Split the test macros into their own file 2020-01-19 16:01:50 +01:00
Martin Hořeňovský acf975cab1
Separate version macros to its own header 2020-01-19 15:39:11 +01:00
Martin Hořeňovský 4005d87460
Use proper linkage between Catch2Main and Catch2 2019-12-18 20:14:34 +01:00
Martin Hořeňovský 0c62a50392
Add the catch_main source file 2019-12-18 18:02:57 +01:00
Martin Hořeňovský 1cc05122d7
Add Catch2Main CMake target that contains test main 2019-12-18 17:25:04 +01:00