Commit Graph

73 Commits

Author SHA1 Message Date
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
Phil Nash
7717c29072 Implemented CHECK_NOFAIL
Previous commit missed some files
2012-11-13 09:45:29 +00:00
Phil Nash
d539da9030 Implemented CHECK_NO_FAIL 2012-11-13 09:44:52 +00:00
Phil Nash
b2ef998825 Changed shouldNegate boolean to use part of ResultDisposition enum 2012-11-10 10:35:09 +00:00
Phil Nash
1af13dba97 Changed StopOnFailure boolean to an enum 2012-11-10 10:20:08 +00:00
Phil Nash
778f9c4fc7 Removed "no-" from Wno-global-constructors when disabling 2012-10-30 09:09:30 +00:00
Phil Nash
e04e74f896 More AssertionResult refactoring 2012-10-24 21:59:47 +01:00
Phil Nash
803f6b7e4b Added SCOPED_CAPTURE 2012-10-04 08:14:48 +01:00
Phil Nash
74d1d31997 Added CATCH_ version of SUCCEED macro 2012-08-31 18:37:47 +01:00