Martin Hořeňovský
0dabd951ba
expr is now cast to void in THROWS family of assertions.
...
This prevents Clang from complaining about unused value in expressions
containing explicit casts used in the THROW assertion macro family.
Example:
`REQUIRE_THROWS_AS(static_cast<bool>(object), std::bad_cast);` would
trigger `-Wunused-value` warning. Now it does not.
Credits to Arto Bendiken, who submitted a PR almost 3 years ago, but his
branch has since died and I was unable to merge it.
2017-01-31 18:02:11 +01:00
Martin Hořeňovský
15816c5760
Revert "use sizeof(expr) for unevaluated syntax check"
...
Using sizeof(expr) can trigger a compile-time error,
"lambda expressions are not allowed in an unevaluated context", when passing
expression containing lambda, like a std algorithm. This error is considered
a standard defect, as it is meant to prevent lambdas in decltype
or templates, but not in sizeof.
This reverts commit 227598af47
.
2017-01-30 11:56:29 +01:00
Martin Hořeňovský
4ce11d63a6
Merge branch 'dev-performance'
2017-01-25 22:56:36 +01:00
Martin Hořeňovský
184865358c
CHECK no longer stops running SECTION on exception.
...
This seems to be much closer to desired behaviour than the current one, where
CHECK(false) lets the execution continue, but CHECK(<throws>) does not.
2017-01-23 17:52:17 +00:00
Mickey Rose
227598af47
use sizeof(expr) for unevaluated syntax check
2017-01-19 21:25:27 +01:00
Martin Hořeňovský
ee0ca512ea
Force short-circuited evaluation for types that have overloaded &&.
...
This fixes #574 .
2017-01-17 23:31:03 +01:00
Mickey Rose
a1e9b841ff
lazily stringify expressions
2017-01-14 21:56:16 +01:00
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