Martin Hořeňovský
03d122a35c
v2.4.2
2018-10-26 21:14:16 +02:00
Martin Hořeňovský
054d356332
Add STATIC_REQUIRE assertion
...
By default, it expands into a `static_assert` + `SUCCEED` pair, but
it can also be deferred to runtime by defining
`CATCH_CONFIG_RUNTIME_STATIC_REQUIRE`, which causes it to expand
into plain old `REQUIRE`.
Closes #1362
Closes #1356
2018-10-16 16:16:00 +02:00
Martin Hořeňovský
9e1bdca466
v2.4.1
2018-09-28 15:52:51 +02:00
Martin Hořeňovský
60b05b2041
v2.4.0
2018-09-04 11:59:15 +02:00
Matthew Parnell
64fd5b8058
Add BDD AND_GIVEN based macros
...
issue #1360
It is possible to have multple given contexts in a single BDD scenario;
if you have to type 'and' in the GIVEN description; it's very likely you
need an AND.
A generic AND is not possible, thus a AND_GIVEN is added to complement
the AND_WHEN and AND_THEN.
Can be used without needing to increase indent:
SCENARIO("...") {
GIVEN("...")
AND_GIVEN("...") {
WHEN("...") {
THEN("...") {
// ...
}
}
}
}
would correctly output, when requested/needed:
Given: ...
And given: ...
When: ...
Then: ...
The padding had to be increased by a character in the output message, to
continue to be uniform.
2018-09-02 16:53:57 +02:00
Phil Nash
7c25dae9ea
First attempt at data generator support
...
The support is to be considered experimental, that is, the interfaces,
the first party generators and helper functions can change or be removed
at any point in time.
Related to #850
2018-08-24 13:31:51 +02:00
Phil Nash
1cdaa48a0b
CAPTURE is now variadic
2018-08-19 22:40:20 +02:00
Martin Hořeňovský
15cf3caace
v2.3.0
2018-07-23 10:12:15 +02:00
Martin Hořeňovský
1c1b447ede
Properly guard CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER definition
2018-07-03 09:29:26 +02:00
Phil Nash
0f49a600b0
Added DYNAMIC_SECTION to CATCH_CONFIG_DISABLE builds
2018-06-25 19:22:57 +01:00
Phil Nash
5c0efa1cfc
Added DYNAMIC_SECTION and implemented GIVEN/ WHEN/ THEN in terms of it
2018-06-25 19:19:21 +01:00
Martin Hořeňovský
d2a130f243
v2.2.3
2018-06-06 23:19:06 +02:00
Martin Hořeňovský
d2d8455b57
v2.2.2
2018-04-06 12:11:22 +02:00
Martin Hořeňovský
0a34cc201e
v2.2.1
2018-03-11 12:04:28 +01:00
Martin Hořeňovský
d14b7563c2
v2.2.0
2018-03-07 11:06:15 +01:00
Martin Hořeňovský
7cbd0b587a
v2.1.2
2018-02-09 17:10:27 +01:00
Martin Hořeňovský
44dbda9f01
Add CATCH_VERSION_* defines for external use
...
I wonder how much use they will actually see, but their cost is
fairly minor.
Closes #1131
2018-01-26 20:56:14 +01:00
Martin Hořeňovský
a8a1c379c0
Introduce a way to intentionally expose interface for use in tests
...
Fixes #1076
2017-11-21 11:10:07 +01:00
Martin Hořeňovský
baf3d2f360
Split out ratio_string::symbol bodies
2017-11-19 14:54:52 +01:00
Martin Hořeňovský
9796a77a37
Initial prototype of PCH support
...
Related to #1061
2017-11-14 21:41:36 +01:00
Phil Nash
927f520a97
Moved windows proxy inclusion outside of CATCH_CONFIG_COLOUR_WINDOWS guard, so workaround early inclusion can be removed
2017-10-12 10:37:23 +01:00
philsquared
cc0b093c20
unconditional windows proxy
2017-10-11 14:58:20 +01:00
Martin Hořeňovský
f972732737
Workaround for stitching issue in #1020
...
Closes #1020
2017-10-03 18:41:49 +02:00
Phil Nash
c5608f0202
Changed all .hpp extensions to .h where there is now a corresponding .cpp
2017-09-07 11:24:33 +01:00
Phil Nash
2d37649377
Fixed Objective-C mode
2017-09-06 15:44:42 +01:00
Martin Hořeňovský
9796c516bb
Always compile matchers implementation
2017-08-30 18:06:48 +02:00
Martin Hořeňovský
cde57d9365
Remove tag alias registry interface from the common path
2017-08-30 15:28:33 +02:00
Martin Hořeňovský
92444d8b72
Remove catch_context.h from the common include path
2017-08-29 15:36:09 +02:00
Martin Hořeňovský
75f143835e
Prevent exception translator registration with CATCH_CONFIG_DISABLE
2017-08-29 09:52:25 +02:00
Martin Hořeňovský
053c29a2b8
Add partial implementation of CATCH_CONFIG_DISABLE
...
* Assertions are defined into (void)(0) no-op
* SECTIONs are defined away (leaving {} as scope)
* TEST_CASEs and TEST_CASE_METHODs are not registered.
* REGISTER_TEST_CASE is defined into (void)(0) no-op
* METHOD_AS_TEST_CASE is defined away
2017-08-27 22:05:25 +02:00
Martin Hořeňovský
cb2fceb119
Force include catch_platform.h before any if-defs
...
Closes #994
2017-08-21 14:58:50 +02:00
Martin Hořeňovský
24af32f378
Add define that pulls in reporter and listeners interfaces
...
This allows users to define reporters and listeners in files different
from the main file.
Related to #991 , #986
2017-08-17 20:23:30 +02:00
Martin Hořeňovský
f99f511155
Removed *_REGISTER_REPORTER from main path
...
Also simplified them to single macro: CATCH_REGISTER_REPORTER
2017-08-17 20:03:16 +02:00
Phil Nash
8582780f11
Don't include string/ vector matchers if CATCH_CONFIG_MATCHERS defined
2017-08-16 14:38:04 +01:00
Phil Nash
97c06ca6fb
Merge branch 'reevaluate' into dev-modernize
2017-08-10 16:18:05 +01:00
Martin Hořeňovský
3382312bd8
Remove obsoleted SCOPED_MSG
and SCOPED_CAPTURE
...
Standard `MSG` and `CAPTURE` behave the same way these used to,
and are recommended instead.
2017-08-10 17:06:32 +02:00
Phil Nash
ee9b19efd3
Moved matcher-based capture macros into their own file
...
- this file excluded from the CATCH_CONFIG_DISABLE_MATCHERS path.
- matchers are always compiled in to the impl file
- _THROWS_WITH macros are still available with matchers disabled - but only the ones that take a string
- tests that use matchers have #ifdefs, so the whole SelfTest project can compile with matchers disable.
2017-08-09 12:10:14 +01:00
Phil Nash
e658bacb04
Refactored how FAST_COMPILE affects internal test macros (less duplication)
2017-08-07 00:09:54 +01:00
Phil Nash
a9b6813ad9
First draft of (experimental) benchmarking support
2017-08-04 19:23:30 +01:00
Martin Hořeňovský
d08e31d89e
Fix inverted CATCH_CONFIG_DISABLE_MATCHERS toggle
2017-07-29 08:43:32 +02:00
Martin Hořeňovský
0ca4cfb743
Introduce compile time toggle to remove Matchers from TU
...
The toggle is `CATCH_CONFIG_DISABLE_MATCHERS` and the only use is
to speed up compilation of small TUs. For large ones it is likely
insignificant, because the speed up is constant relative to
number of tests/assertions in TU.
2017-07-28 21:34:34 +02:00
Martin Hořeňovský
35c1301bd5
Fix missing CATCH_ prefixed macros
2017-07-28 21:04:18 +02:00
Martin Hořeňovský
33fd54a673
Split Option<T> and TagAlias definitions away from the main include path
2017-07-27 11:55:30 +02:00
Phil Nash
f193698fb3
Removed all (that I could find) redundant second macro args to TEST_CASE and SECTION
...
- now we can rely on variadic macros
2017-07-13 09:20:37 +01:00
Martin Hořeňovský
91c1556078
Moved Catch NotImplementedException out of the common include path
...
We could probably toss it away completely, currently it is used
only by TeamCity reporter.
2017-07-12 15:05:01 +02:00
Martin Hořeňovský
4332b84c9b
Moved leak detector to its own file
2017-07-12 15:03:52 +02:00
Martin Hořeňovský
9c318af987
Remove obsolete GENERATE macro
2017-07-12 14:46:49 +02:00
Martin Hořeňovský
fae0fa4ec1
Merge branch 'dev-second-string-argument-removal' into dev-modernize
...
It is no longer true that an assertion macro has either 1 or 2 args,
so...
2017-06-26 20:48:41 +02:00
Martin Hořeňovský
950cae9040
Added new assertion macros: *_THROWS_WITH
...
It combines `*_THROWS_AS` and `*_THROWS_WITH` macros, so that the
exception type matches expectetations and its contents match a specific
matcher.
2017-06-05 18:40:50 +02:00
Martin Hořeňovský
1e16be0b9e
Purge deprecated generators
2017-06-05 16:49:10 +02:00
Martin Hořeňovský
377c9a746d
Cosmetic fixes (whitespace and spelling)
2017-05-27 14:42:54 +02:00
Martin Hořeňovský
589c40077b
Typo fix
...
Somehow I made that in 5ffc8a84cd
without noticing
2017-05-16 13:51:17 +02:00
Martin Hořeňovský
33ed1773f4
Reworked stringification layer, removed Catch::toString
...
Now the order of stringification checks is
1) StringMaker specialization
2) operator<<
toString overloads and specializations have been removed.
2017-05-02 23:51:03 +02:00
Martin Hořeňovský
40130e59b4
Fix order of arguments in CATCH_FAIL macro
2017-04-28 18:33:52 +02:00
Martin Hořeňovský
5ffc8a84cd
Fix order of arguments in CATCH_FAIL and nonvariadic INTERNAL_CATCH_MSG
...
Fixes #896
2017-04-28 18:30:04 +02:00
Phil Nash
602b62f037
Removed legacy reporter support
2017-04-25 21:56:14 +01:00
Martin Hořeňovský
e1bca7017d
Most of Assertion macros are now variadic
...
This means that `REQUIRE(std::vector<int>{1, 2} == std::vector<int>{1,
2});` works as expected.
Note that assertion macros taking more than 1 argument are currently not
variadic, because variadic args have to come last, which would make the
interface of these ugly: `REQUIRE_THROWS_AS(std::exception const&, ....
)`
2017-04-25 20:20:46 +02:00
Martin Hořeňovský
71df66365e
Gutted catch_compiler_capabilities
...
All C++11 toggles are now removed. What is left is either platform
specific (POSIX_SIGNALS, WINDOWS_SEH), or possibly still needed
(USE_COUNTER).
If current CLion is compatible with `__COUNTER__`, then we should also
force `__COUNTER__` usage.
Changed
* CATCH_AUTO_PTR -> std::unique_ptr
* CATCH_OVERRIDE -> override
* CATCH_NULL -> nullptr
* CATCH_NOEXCEPT -> noexcept
* CATCH_NOEXCEPT_IS -> noexcept
Removed
* CATCH_CONFIG_CPP11_UNIQUE_PTR
* CATCH_CONFIG_CPP11_SHUFFLE
* CATCH_CONFIG_CPP11_TYPE_TRAITS
* CATCH_CONFIG_CPP11_OVERRIDE
* CATCH_CONFIG_CPP11_LONG_LONG
* CATCH_CONFIG_CPP11_TUPLE
* CATCH_CONFIG_CPP11_IS_ENUM
* CATCH_CONFIG_CPP11_GENERATED_METHODS
* CATCH_CONFIG_CPP11_NOEXCEPT
* CATCH_CONFIG_CPP11_NULLPTR
* CATCH_CONFIG_VARIADIC_MACROS
2017-04-25 12:43:19 +02:00
Phil Nash
f3ec843ba6
Changed all internal forwarding macro usages to put macro name as first argument
...
(and ‘expression’, if any, last)
This is a first step towards allowing expression arguments to become variadic
2017-03-21 13:23:35 +00:00
Martin Hořeňovský
7a8a0205b4
CATCH_CONFIG_FAST_COMPILE now disables trys in REQUIRE*
...
This seems to give about 15% speedup when compiling tests using GCC.
The tradeoff is that under certain circumstances, there is a chance for
false negative result, when the expression under test throws exception
and the test code catches it before it gets to the test runner.
Example:
``` cpp
TEST_CASE("False negative") {
try {
REQUIRE(throws() == "");
} catch (...) {}
}
```
This test case will succeed, reporting no assertions checked, instead of
failing as it would with `CATCH_CONFIG_FAST_COMPILE` disabled. However,
just removing the try-catch block inside client's code will fix this, so
it is worthwhile.
This change does not apply to CHECK* macros, because these are currently
specified as continuing on exception and thus need the local try-catch
to work as intended.
2017-03-17 13:21:40 +01:00
Phil Nash
5dd0639520
Added FAIL_CHECK
...
Works like FAIL, but does not abort test.
As proposed in #765
2017-03-08 15:42:11 +00:00
Martin Hořeňovský
be4f6ab8e1
Change reporting of CAPTURE'd variables
...
Info is not changed, intentionally.
Closes #639
2017-03-03 14:34:50 +01:00
Phil Nash
10dfca34ac
Added first vector matchers (Contains and Equals)
2017-02-21 16:05:04 +00:00
philsquared
b1835e1de9
Moved WIndows leak detector code out of main()
2017-02-17 23:43:31 +00:00
Phil Nash
1400127d6f
Extracted string matchers impl into cpp that is only compiled into main TU
2017-02-14 09:16:54 +00:00
Phil Nash
7fed25ad1f
New Matchers implementation
...
- simpler
- less templates and machinery
- no cloning, copying or unnecessary heap allocations
- better factored
2017-02-14 09:16:54 +00:00
jbo-ableton
e12fc4aca0
Fix missing CATCH_ for CHECK_THAT in prefixed macro version
2017-01-15 22:11:43 +01:00
Kevin Ushey
7d2668fa15
add missing argument to CATCH_CHECK_THROWS ( closes #602 )
2017-01-07 12:16:06 +01:00
Phil Nash
aca16a0f99
Fixed CATCH_REGISTER_TEST_CASE too
2016-01-22 07:50:10 +00:00
Phil Nash
f294c98472
Fixed REGISTER_TEST_CASE for VS2013 (hopefully)
...
- see #549
2016-01-05 08:19:16 +00:00
Phil Nash
2106d82881
Fixed non-variadic version of REGISTER_TEST_CASE
2015-12-09 18:24:29 +00:00
Phil Nash
0e64973f55
Added support for manually registering test functions.
...
As discussed in #421
2015-11-20 16:58:16 +00:00
Phil Nash
6de135c63a
Given, When, Then prefixes are now std::strings
...
(and so can be prepended to std::strings themselves)
see #455
2015-07-22 18:07:28 +01:00
Phil Nash
72868920bb
Exception message assertions now work with matchers
2015-07-15 23:02:25 +01:00
Phil Nash
85de743d70
Added _THROWS_WITH macros
...
- asserts on exception message
2015-07-13 06:34:41 +01:00
Phil Nash
fc63b020c5
suppressed some more warnings
2015-05-21 06:15:53 +01:00
Phil Nash
db0421e840
First commit of (in progress) TeamCity reporter
...
Should run but is not complete
2014-12-19 17:52:33 +00:00
James Wilkinson
63005a1d89
Added SCENARIO_METHOD for BDD testing with fixtures.
2014-07-10 10:22:20 +01:00
Phil Nash
1d210ebd37
Tag aliases feature
2014-06-30 07:33:17 +01:00
Phil Nash
be9fe76101
Renamed ShouldNegate to FalseTest
2014-05-29 08:00:20 +01:00
Phil Nash
9438a03d5b
Big assertion capture refactoring.
...
- moved as much logic out of the macros as possible
- moved most logic into new ResultBuilder class, which wraps ExpressionResultBuilder (may take it over next), subsumes ResultAction and also takes place of ExpressionDecomposer.
This introduces many SRP violations - but all in the name of minimising macro logic!
2014-05-28 18:53:01 +01:00
Phil Nash
3bdc97d8ad
Suppressed a load of warnings
2014-05-19 18:57:14 +01:00
Phil Nash
5ce900a532
Removed some #pragmas that have been causing problems for now
2014-05-04 09:16:32 +01:00
Phil Nash
9f1e054a42
Suppress some more warnings
2014-05-01 07:03:06 +01:00
Phil Nash
f9df35b12b
Fixed instance of Clara::_ placeholder when using CATCH_CONFIG_RUNNER
2014-03-10 18:02:18 +00:00
Phil Nash
9abb27676d
Fix problem (hopefully) with single source definitions from Clara
...
- define CLARA_CONFIG_MAIN in the right place
2014-03-06 21:53:34 +00:00
Phil Nash
557b3bdbe3
Made SUCCESS variadic too (optional stream)
2013-12-14 23:16:03 +00:00
Phil Nash
274ed3ea76
Allow FAIL() to be empty
2013-12-12 23:02:31 +00:00
Phil Nash
c4a089c12b
Refactored a lot of code from headers into impl headers only compiled into one TU
...
- also added noimpl option to single header script - which only generates the non impl code
2013-12-03 18:52:41 +00:00
Phil Nash
b5fd5a6496
INFO and CAPTURE are now scoped
...
- SCOPED_INFO and SCOPED_CAPTURE are now just aliases
2013-06-28 17:09:57 +01:00
Phil Nash
597ed1f79d
handle TEST_CASE_METHOD macro consistently
...
- internally define INTERNAL_CATCH_TEST_CASE_METHOD
2013-05-14 19:31:21 +01:00
Phil Nash
bf37e6879a
Removed use of compiler specific techniques for denoting non-returning functions
...
- use if( Catch::isTrue( true) ) to guard throws instead
2013-04-23 20:52:49 +01:00
Phil Nash
4dd3f68dd9
Compiler capabilities clean-up
...
- renamed CATCH_SFINAE -> CATCH_CONFIG_SFINAE
- moved variadic macros detection into catch_compiler_capabilities.h
2013-04-22 08:19:17 +01:00
Phil Nash
1c03b4a363
Exclude VS2005 from using variadic macros
...
- due to issues raised in https://groups.google.com/forum/?fromgroups=#!topic/catch-forum/VGfNtNXjHXQ
2013-04-09 08:19:04 +01:00
Phil Nash
15fd032608
Use new line wrapper to show test case list, with tags, in columns
2013-03-28 22:13:31 +00:00
Phil Nash
444f4ddc60
Variadics support for BDD macros (scenarios)
2013-03-16 20:39:19 +00:00
Phil Nash
c0b698073e
Initial support for variadic macros
2013-03-16 20:18:52 +00:00
Phil Nash
37186a1d04
Added BDD macros
...
(Also includes regenerated files from previous commits)
2013-03-13 12:19:30 +00:00
Phil Nash
207b27b3c5
Changed the way info messages are handled.
...
This fixes issue with SCOPED_INFO and makes output more readable.
Needs some refactoring.
2013-02-02 19:58:04 +00:00
Phil Nash
8255acf88f
IStreamingReporter is now the default. Use REGISTER_LEGACY_REPORTER to register… you guessed it: legacy reporters
...
The built-in reporters are still legacy at the moment.
2012-11-30 19:29:03 +00:00