Commit Graph

122 Commits

Author SHA1 Message Date
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
Phil Nash
a70fbe3c1a Completed NoAssertions warning implementation 2012-08-31 08:10:36 +01:00
Phil Nash
cda21492a8 Conditionally compile clang pragmas 2012-08-16 18:47:41 +01:00
Phil Nash
ddfe963623 Split imll from TestCaseInfo 2012-08-14 19:30:30 +01:00
Phil Nash
a695eb9006 Builds almost completely cleanly with -WEverything in LLVM 2012-08-13 07:46:10 +01:00
Phil Nash
1091ca81e6 First cut of StaticRegistries - separate from Context 2012-08-06 20:16:53 +01:00
Phil Nash
46bcd4b2b7 Added ability to specify if macros should be prefixed with CATCH_ 2012-07-20 18:43:48 +01:00
Phil Nash
0f9c551d4d Moved catch_interfaces_runner.hpp out of conditionally compiled section 2012-06-02 23:12:42 +01:00
Phil Nash
1787da54a7 Reinstated #include that broke single include 2012-05-22 22:21:17 +01:00
Phil Nash
371db8b42f Context methods are non-static - accessed via interface
This is a move towards allowing multiple contexts - with the concept of a (possibly thread local) "current" context
2012-05-21 18:52:09 +01:00
Phil Nash
ee18b8c507 Reformatting 2012-05-16 15:02:51 +01:00
Phil Nash
5ec53b2788 renamed hub -> context
(also did some reformatting)
2012-05-10 07:58:48 +01:00
Phil Nash
e0dd4a5469 Sanitised some comments 2012-05-09 19:37:14 +01:00
Phil Nash
a6a40b3ba9 Added a handful of "built-in" matchers 2012-03-04 20:10:36 +00:00
Phil Nash
eca5637c58 First cut of Matcher support 2012-03-04 11:14:21 +00:00
Phil Nash
a162e22fa3 Added CHECKED_IF and CHECKED_ELSE 2012-02-10 08:30:13 +00:00
Phil Nash
8152825e9f Fixed Obj-C related #include ordering 2011-08-15 09:06:31 +01:00
Phil Nash
8350ef6366 Re-ordered Obj-C headers to fix dependency issue 2011-08-12 18:52:10 +01:00
Phil Nash
1adebefb50 Fixed tests with string literal on lhs 2011-06-29 19:22:56 +01:00
Phil Nash
48112c2700 Fixed a potential ordering issue with output streambufs 2011-05-31 18:47:30 +01:00
Phil Nash
89d1e6c4f1 Tweaks to allow headers to be glued together.
Added Python script to generate single header.
Added new XCode project that runs self test against single header
2011-05-24 08:23:02 +01:00
Phil Nash
d7c203c3e9 Factored Approx out into own file 2011-04-28 08:03:28 +01:00
Phil Nash
95419e935c Merges objc top level headers into main headers (using #ifdef __OBJC__) 2011-04-26 19:00:25 +01:00
Phil Nash
823ea3efd4 Re-org 2011-04-26 08:32:40 +01:00