Commit Graph

139 Commits

Author SHA1 Message Date
Phil Nash
7940d58a2f "test" expression using !! instead of static_cast to bool.
This addresses #657 while (hopefully) maintaining fix for #574
2016-05-12 19:17:55 +01:00
Phil Nash
91bfe68a75 Suppress parentheses warnings on clang and gcc
- should address #593, #528, #521, #496 (and possibly others)
2016-02-29 08:03:48 +00:00
Phil Nash
ffad3a0a39 Fix as suggested in #574
Cast expression to bool to prevent custom && from defeating short-circuiting
2016-02-10 05:49:56 +00:00
Simon Warta
a5fba672e1 Add missing comma when in captured expression for matchers
Such that
CHECK_THAT( hex_encode(outbuf) Equals("B5D4045C") )
becomes
CHECK_THAT( hex_encode(outbuf), Equals("B5D4045C") )
2015-12-10 08:09:10 +00:00
Phil Nash
f3e7722cc6 Don't introduce Catch::Matchers namespace in macro
- this could be a breaking change - fixed up self-test code to compensate
2015-11-05 18:10:33 +00: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
8cc1108f2b Use <= operator instead of ->* for decomposer
Allows more complex LHS expressions - and works around an Eclipse bug.
See Issues #359, #393 and #247 for details
2015-06-26 06:46:37 +01:00
Phil Nash
5eb7748a55 Changed relative #includes and made SourceLineInfo sortable (added < op) 2015-03-04 07:17:12 +00:00
Phil Nash
ea33961b43 Factored out mention of "unprintable string" ("{?}") 2014-09-08 08:14:59 +01:00
Phil Nash
11cf45bc41 Fixed regression with -e 2014-06-05 18:11:31 +01:00
Phil Nash
10801c2876 Folded ExpressionResultBuilder into ResultBuilder
(even more SRP violations!)
2014-05-29 07:50:19 +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
5daa22dcc3 Fixed dereferenced null issue 2014-05-20 18:49:28 +01:00
Phil Nash
97150f27ac Renamed catch_tostring.hpp catch_tostring.h
- in preparation for splitting implementation into catch_tostring.hpp
2014-04-23 06:51:58 +01:00
Phil Nash
970127e488 Removed some unnecessary core macros 2014-04-16 18:01:31 +01:00
Phil Nash
1bccc03213 Secondary fix for #270 (addresses same issue with CHECK) 2014-04-12 19:20:46 +01:00
Phil Nash
a176b93738 Fix for #270 (REQUIRE continues if test throws an exception).
Added test case that reproduced the bug then applied the fix.
2014-04-12 19:07:24 +01:00
Phil Nash
b4625208d0 Test for FAIL that doesn’t take an argument 2013-12-14 14:30:58 +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
1e2f1d1603 Fixes toString forward reference issue:
- as raised in https://github.com/philsquared/Catch/pull/195
2013-09-14 19:58:45 +01:00
Phil Nash
f3d1f08c3b Removed all trailing whitespace
- addresses #105
2013-07-03 19:14:59 +01: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
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
2a9d8d9e36 Changed "const X ref"s to "X const ref"s
- Brought older code up to current convention (with the help of a Python script)
2013-04-23 18:58:56 +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
2666c96d4e Fixes issue #164
- Removed spurious (re-)throw when catching unexpected exception
2013-04-20 21:04:32 +01:00
Phil Nash
3df6c0d1b4 Refactored ConsoleColour impl. Tweaked the (Windows) colours a bit.
Also fixed issue that would cause warnings on some compilers when doing REQUIRE( p ); where p is a pointer.
Moved to build 23
2013-03-11 18:38:29 +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
d539da9030 Implemented CHECK_NO_FAIL 2012-11-13 09:44:52 +00:00
Phil Nash
defca58566 negate() -> endExpression(), takes ResultDisposition 2012-11-10 18:43:23 +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
ec5956f471 Fix for #134
The INTERNAL_CATCH_MSG macro, which is used by INFO, WARN and FAIL places its lines in a do…while block so it can be used after an if statement with no block
2012-11-06 07:52:28 +00:00
Phil Nash
81cb69ef18 AssertionInfo captures more info (for test cases and sections) 2012-11-04 21:09:22 +00:00
Phil Nash
2e203a1834 Fixed remaining reporting regressions 2012-10-29 19:55:13 +00:00
Phil Nash
fe1d7c1d08 Small fixes and tweaks 2012-10-28 10:27:44 +00:00
Phil Nash
355b5e546d Some tidy-up 2012-10-26 09:05:36 +01:00
Phil Nash
f847186ebb AssertionResultBuilder -> ExpressionResultBuilder 2012-10-26 08:45:23 +01:00
Phil Nash
8cca2f1369 ExpressionBuilder ->ExpressionDecomposer
Expression -> ExpressionLhs
2012-10-24 22:09:01 +01:00
Phil Nash
e04e74f896 More AssertionResult refactoring 2012-10-24 21:59:47 +01:00
Phil Nash
1dd56d4d2b AssertionResultBuilder can be constructed from result type 2012-10-19 08:01:34 +01:00
Phil Nash
e3b111a39a streamlined acceptResult 2012-10-18 22:59:16 +01:00
Phil Nash
3ad13256e1 Refactored assertion builder stuff out of expression builder 2012-10-18 08:39:44 +01:00
Phil Nash
c96f9330a0 Collect assertion info up front 2012-10-17 08:14:22 +01:00
Phil Nash
d16955f63a Renamed ResultInfo -> AssertionResult 2012-10-16 08:27:21 +01:00
Phil Nash
71edf8b727 isNot -> isFalse 2012-10-09 11:59:11 +01:00
Phil Nash
86e1915099 Refactoring ResultData out of ResultInfo/ Builder pt1 2012-10-05 18:35:01 +01:00
Phil Nash
36d0da0194 Started refactoring ResultInfo/Builder 2012-10-04 08:09:09 +01:00
Phil Nash
ec2fccf6b8 Fixed SCOPED_INFO (#123) 2012-09-24 08:28:23 +01:00
Phil Nash
da0ae952fc Renamed static registries -> registry hub 2012-08-07 07:58:34 +01:00
Phil Nash
1091ca81e6 First cut of StaticRegistries - separate from Context 2012-08-06 20:16:53 +01:00
Phil Nash
abf271672f Added NotImplementedException 2012-07-05 18:37:58 +01:00
Phil Nash
46a3476731 Added nothrow command line option
Causes _THROWS family of macros to no evaluate expression
2012-06-05 20:50:47 +01:00
Phil Nash
19b2aa6187 Added cutoff option to command line
Aborts testing after a certain number of assertion failures
2012-06-01 19:40:27 +01:00
Phil Nash
7035b55832 Matchers macro uses Catch::Matchers namespace internally - so it doesn't have to be declared with "using" first 2012-05-24 08:29:03 +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
2efc1146bf Reformatting 2012-05-15 07:42:26 +01:00
Phil Nash
6acb36a996 Renamed ResultBuilder -> ExpressionBuilder 2012-05-11 19:22:28 +01:00
Phil Nash
7a0cadc342 Moved ResultBuilder out into its own file 2012-05-11 19:15:54 +01:00
Phil Nash
a6855f7eab Move expression classes into own file 2012-05-11 08:03:05 +01:00
Phil Nash
5ec53b2788 renamed hub -> context
(also did some reformatting)
2012-05-10 07:58:48 +01:00
Phil Nash
d06dcedfdc Some more reformatting.
Also fixed some warnings
2012-05-09 08:17:51 +01:00
Phil Nash
e83f839741 Renamed MutableResultInfo to ResultInfoBuilder 2012-05-08 19:32:18 +01:00
Phil Nash
b5d367206b Factored MutableResultInfo into its own file 2012-05-08 19:29:51 +01:00
Phil Nash
5d1c8f2c6d Replaced all file/ line pairings with SourceLineInfo 2012-05-08 19:16:18 +01:00
Phil Nash
81a122e66a Factored toString overloads into their own file 2012-05-08 08:10:49 +01:00
Phil Nash
40b161adea Some reformating 2012-05-08 07:59:54 +01:00
Phil Nash
83a66a6255 Removed redundant const
(also fixed test counts)
2012-04-28 12:39:15 +01:00
Phil Nash
53c990a7e1 ARC support for Object-C projects 2012-03-17 18:20:06 +00:00
Phil Nash
966f5dbff2 Added initial built-in matchers for NSString (ObjC) 2012-03-04 21:18:46 +00:00
Phil Nash
eca5637c58 First cut of Matcher support 2012-03-04 11:14:21 +00:00
Phil Nash
5ff4ab0a76 Suppress warning about constant conditional 2012-02-29 08:47:18 +00:00
Phil Nash
f52bd35e2f made CHECK/ REQUIRE into block statements
Placed the contents of the macros into do{…}while(0) so they can be used as statements (e.g. after an if() with no braces).
Also means they now require the closing ;
2012-02-29 08:35:41 +00:00
Phil Nash
333e6e6254 Improved exception reporting
Refactored exception handling (handle more in the translator)
and report exceptions in CHECKs
2012-02-17 19:50:59 +00:00
Phil Nash
a162e22fa3 Added CHECKED_IF and CHECKED_ELSE 2012-02-10 08:30:13 +00:00
Phil Nash
4094e7fe3d Merge branch 'master' of github.com:philsquared/Catch 2011-09-29 18:42:32 +01:00
Phil Nash
a713ce0264 Simplified streamable detection 2011-09-29 09:01:59 +01:00
Wichert Akkerman
6d18d4b189 Fix compiler warnings
Fix base classes without virtual destructors and missing initialisors.
2011-09-23 10:03:52 +02:00
Phil Nash
08a1b51987 Hold values by value and references by reference 2011-09-19 18:19:13 +01:00
Phil Nash
4d0a8d96e6 Fixed issue with evaluating static bools 2011-08-09 08:18:27 +01:00
Phil Nash
3723b527f5 Some fixes for string literals on LHS 2011-07-15 08:07:44 +01:00
Phil Nash
1adebefb50 Fixed tests with string literal on lhs 2011-06-29 19:22:56 +01:00
Phil Nash
eb2964e4ae Disambiguated some locally scoped names 2011-06-23 08:13:25 +01:00
Phil Nash
4b24490e1a Fixed Github Issue #32: "ResultBuilder& operator << should use toString" 2011-05-11 10:06:28 +01:00
Phil Nash
d7c203c3e9 Factored Approx out into own file 2011-04-28 08:03:28 +01:00
Phil Nash
38edb9fa95 Removed bool warning 2011-04-26 08:35:52 +01:00
Phil Nash
823ea3efd4 Re-org 2011-04-26 08:32:40 +01:00