Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorPhil Nash2012-11-13 21:59:50 +0000
committerPhil Nash2012-11-13 21:59:50 +0000
commit42d1b4538696ecb4cb938a9e43b79084b23ff12e (patch)
tree42e259564a3601c2ad0002939325332a6ad40ce5 /include
parent4f13f5b7d3c4e7e9c9453b5740ae7028810e4127 (diff)
downloadcatch3-42d1b4538696ecb4cb938a9e43b79084b23ff12e.tar.gz
Squashed commit of the following:
commit 70c5ef9eede41e7061ff1af45b5babe0d7cde4ba Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 21:46:01 2012 +0000 Regen single include commit 4ea535e5059a664cc393404b454f29e6dad0886e Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:56:30 2012 +0000 Tidied up result enums commit 7717c29072013fd45e36d1bc48527927fa94cbed Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:45:29 2012 +0000 Implemented CHECK_NOFAIL Previous commit missed some files commit d539da903032e5a6f2bf40d6d7d8e7874c860088 Author: Phil Nash <github@philnash.me> Date: Tue Nov 13 09:44:52 2012 +0000 Implemented CHECK_NO_FAIL commit af1a321860a8b63fb57fcade75ba7f33cad7400c Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:46:39 2012 +0000 Regen single include commit f54ac5625e4702e1c032f7b5a7f4d9346c64f502 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:44:12 2012 +0000 New (combined) baselines commit defca58566653fd088f615c2979d7e7a681bf107 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 18:43:23 2012 +0000 negate() -> endExpression(), takes ResultDisposition commit b2ef99882590ccd3824ebca44cb9b4cfc42f4728 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 10:35:09 2012 +0000 Changed shouldNegate boolean to use part of ResultDisposition enum commit 1af13dba97474c2a0b33f1ca1919c80ea4f95ca3 Author: Phil Nash <github@philnash.me> Date: Sat Nov 10 10:20:08 2012 +0000 Changed StopOnFailure boolean to an enum commit a1dc7e312cffb0a2d241273adcae4a126d49ff15 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:34:35 2012 +0000 Regen single include commit 20e59ce9d133b469798c4ce2a8d681c0d9b18975 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:34:10 2012 +0000 Added tags docs commit b5b1b1e430c8c61dbd3162da0255a368ba9ad75f Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 19:13:25 2012 +0000 Some expression/ evaluation clean-up commit ec5956f47114ff8b597be85fd7654d29da93aea0 Author: Phil Nash <github@philnash.me> Date: Tue Nov 6 07:52:28 2012 +0000 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 commit 88b70828f24bbbeae636d663b14fd0117165108a Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:39:38 2012 +0000 Regen single include commit b323fc7e6c57caa535d65cae31e6018822ed9e3c Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:39:16 2012 +0000 Fixed line/no regression for SECTIONs Unexpected exceptions within a section now get the SECTION's line no. again (instead of TEST_CASE line/no) commit 78fba28c4b9f48ec25c9d234a29c36e4427ca6e0 Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:11:59 2012 +0000 Added className to TestCaseInfo className is passed through from class based test methods and held in the TestCaseInfo. For free-function based test cases it is set to "global". The JUnit reporter uses the className value to populate he class attribute. commit 81cb69ef1831ed29bf770254c9112b8f0465e912 Author: Phil Nash <github@philnash.me> Date: Sun Nov 4 21:09:22 2012 +0000 AssertionInfo captures more info (for test cases and sections) commit a4e088c999439e9ec0fe3a4205b7520fbf258a5f Author: Phil Nash <github@philnash.me> Date: Fri Nov 2 08:29:03 2012 +0000 Removed __FUNCTION__ from SourceLineInfo commit 2a1e8bfc6ed3bcc1e3746d717726a9e525de6369 Author: Phil Nash <github@philnash.me> Date: Thu Nov 1 08:16:15 2012 +0000 Updated colour comments commit f0f407fc3ebdcbdad50fc1f9a45f15ab3cc54c63 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:28:21 2012 +0000 Manually applied merge #133 from Master commit 355b95fda1de28ba830541768aad32c7b1790290 Author: Phil Nash <github@philnash.me> Date: Wed Oct 31 18:04:22 2012 +0000 Cleaned up ANSI colour code impl a bit commit 778f9c4fc7fa66566679d9f1d8a721079d8589bf Author: Phil Nash <github@philnash.me> Date: Tue Oct 30 09:09:30 2012 +0000 Removed "no-" from Wno-global-constructors when disabling commit 5efa4bcb8a620efa13e8eb5e68d0899681919ca1 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:49:22 2012 +0000 Regenerated single_include commit 108f1937d8cbe04038ab8d2aaf9f6e958fe8168c Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 20:46:45 2012 +0000 Added terminal colour codes for POSIX With thanks to Adam Strzelecki commit 8f4cc541d55cf55b2a67b5d6b77b5c4ceb4d99ee Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:34 2012 +0000 Added regression test baselines commit 2e203a183474672e386f4cf840847cf29ccf90b9 Author: Phil Nash <github@philnash.me> Date: Mon Oct 29 19:55:13 2012 +0000 Fixed remaining reporting regressions commit 134e45b3ade922e5cbdb2df6b81830fbd93fe448 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 20:57:21 2012 +0000 Fixed #132 commit 2f92db9898978ca1ee27c964d8a51fa507391935 Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:15:34 2012 +0000 Updated the readme specifically for the Integration branch commit 82acc2ca05459ce353de71469f141ba93e9b63cf Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 12:07:17 2012 +0000 Regenerated single include commit fe1d7c1d08f06c0a83b727e9b2e00cc49e74175d Author: Phil Nash <github@philnash.me> Date: Sun Oct 28 10:27:44 2012 +0000 Small fixes and tweaks commit 355b5e546d2f64dd0abbc0134dd3579ce6c28cea Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 09:05:36 2012 +0100 Some tidy-up commit f847186ebbf0e7eeabd99925574c8988add600fb Author: Phil Nash <github@philnash.me> Date: Fri Oct 26 08:45:23 2012 +0100 AssertionResultBuilder -> ExpressionResultBuilder commit 8cca2f13699aa6aa5cd4a60e293f49a1bae54629 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 22:09:01 2012 +0100 ExpressionBuilder ->ExpressionDecomposer Expression -> ExpressionLhs commit e04e74f896c714de1f03a9cc006bcd071318ea11 Author: Phil Nash <github@philnash.me> Date: Wed Oct 24 21:59:47 2012 +0100 More AssertionResult refactoring commit 1dd56d4d2b29520cdd62f5f449a28e67f954f5db Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:34 2012 +0100 AssertionResultBuilder can be constructed from result type commit f2d5f1b3e444055ff02ed0536d5d0610b08ecb9f Author: Phil Nash <github@philnash.me> Date: Fri Oct 19 08:01:05 2012 +0100 Expression has its own result builder - not passed in from expression builder commit e3b111a39a4edd3bfe4d88290c99c723b8b74417 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 22:59:16 2012 +0100 streamlined acceptResult commit 3ad13256e1e50a6ee4a2697e7b6d0f669ae82ab5 Author: Phil Nash <github@philnash.me> Date: Thu Oct 18 08:39:44 2012 +0100 Refactored assertion builder stuff out of expression builder commit c96f9330a095f527673de4d8db4f434d38a7e813 Author: Phil Nash <github@philnash.me> Date: Wed Oct 17 08:14:22 2012 +0100 Collect assertion info up front commit a5fa78284d6d95770cd647a2ec10df09d378ba46 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:33:13 2012 +0100 ResultData -> AssertionResultData commit c597a893fa95462b8d2d5029547d4054eda1839f Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:31:05 2012 +0100 ResultInfo -> AssertionResult filenames and variables commit d16955f63a4a128221da41602215b5592df39eb9 Author: Phil Nash <github@philnash.me> Date: Tue Oct 16 08:27:21 2012 +0100 Renamed ResultInfo -> AssertionResult commit 175da3ef6454b6fa0465d22c96d21d58dd9d2f90 Author: Phil Nash <github@philnash.me> Date: Fri Oct 12 18:39:22 2012 +0100 regen test 3
Diffstat (limited to 'include')
-rw-r--r--include/catch.hpp92
-rw-r--r--include/internal/catch_assertionresult.h16
-rw-r--r--include/internal/catch_assertionresult.hpp24
-rw-r--r--include/internal/catch_capture.hpp80
-rw-r--r--include/internal/catch_commandline.hpp9
-rw-r--r--include/internal/catch_common.h13
-rw-r--r--include/internal/catch_evaluate.hpp43
-rw-r--r--include/internal/catch_expression_lhs.hpp6
-rw-r--r--include/internal/catch_expressionresult_builder.h2
-rw-r--r--include/internal/catch_expressionresult_builder.hpp4
-rw-r--r--include/internal/catch_interfaces_capture.h1
-rw-r--r--include/internal/catch_notimplemented_exception.hpp2
-rw-r--r--include/internal/catch_result_type.h79
-rw-r--r--include/internal/catch_runner_impl.hpp40
-rw-r--r--include/internal/catch_tags.hpp4
-rw-r--r--include/internal/catch_test_case_info.h8
-rw-r--r--include/internal/catch_test_case_info.hpp21
-rw-r--r--include/internal/catch_test_case_registry_impl.hpp25
-rw-r--r--include/internal/catch_test_registry.hpp14
-rw-r--r--include/reporters/catch_reporter_basic.hpp12
-rw-r--r--include/reporters/catch_reporter_junit.hpp7
-rw-r--r--include/reporters/catch_reporter_xml.hpp4
22 files changed, 276 insertions, 230 deletions
diff --git a/include/catch.hpp b/include/catch.hpp
index 219b6172..54acd738 100644
--- a/include/catch.hpp
+++ b/include/catch.hpp
@@ -48,31 +48,32 @@
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
#ifdef CATCH_CONFIG_PREFIX_ALL
-#define CATCH_REQUIRE( expr ) INTERNAL_CATCH_TEST( expr, false, true, "CATCH_REQUIRE" )
-#define CATCH_REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( expr, true, true, "CATCH_REQUIRE_FALSE" )
-
-#define CATCH_REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., true, "CATCH_REQUIRE_THROWS" )
-#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, true, "CATCH_REQUIRE_THROWS_AS" )
-#define CATCH_REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, true, "CATCH_REQUIRE_NOTHROW" )
-
-#define CATCH_CHECK( expr ) INTERNAL_CATCH_TEST( expr, false, false, "CATCH_CHECK" )
-#define CATCH_CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( expr, true, false, "CATCH_CHECK_FALSE" )
-#define CATCH_CHECKED_IF( expr ) INTERNAL_CATCH_IF( expr, false, false, "CATCH_CHECKED_IF" )
-#define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, false, false, "CATCH_CHECKED_ELSE" )
-
-#define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., false, "CATCH_CHECK_THROWS" )
-#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, false, "CATCH_CHECK_THROWS_AS" )
-#define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, false, "CATCH_CHECK_NOTHROW" )
-
-#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, false, "CATCH_CHECK_THAT" )
-#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, true, "CATCH_REQUIRE_THAT" )
-
-#define CATCH_INFO( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Info, false, "CATCH_INFO" )
-#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, false, "CATCH_WARN" )
-#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, true, "CATCH_FAIL" )
-#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, false, "CATCH_SUCCEED" )
+#define CATCH_REQUIRE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal, "CATCH_REQUIRE" )
+#define CATCH_REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal | Catch::ResultDisposition::NegateResult, "CATCH_REQUIRE_FALSE" )
+
+#define CATCH_REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THROWS" )
+#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THROWS_AS" )
+#define CATCH_REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_NOTHROW" )
+
+#define CATCH_CHECK( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK" )
+#define CATCH_CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::NegateResult, "CATCH_CHECK_FALSE" )
+#define CATCH_CHECKED_IF( expr ) INTERNAL_CATCH_IF( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_IF" )
+#define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_ELSE" )
+#define CATCH_CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CATCH_CHECK_NOFAIL" )
+
+#define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS" )
+#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS_AS" )
+#define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_NOTHROW" )
+
+#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THAT" )
+#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THAT" )
+
+#define CATCH_INFO( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Info, Catch::ResultDisposition::ContinueOnFailure, "CATCH_INFO" )
+#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "CATCH_WARN" )
+#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL" )
+#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED" )
#define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_SCOPED_INFO( msg, "CATCH_SCOPED_INFO" )
-#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_MSG( #msg " := " << msg, Catch::ResultWas::Info, false, "CATCH_CAPTURE" )
+#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_MSG( #msg " := " << msg, Catch::ResultWas::Info, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CAPTURE" )
#define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_SCOPED_INFO( #msg " := " << msg, "CATCH_SCOPED_CAPTURE" )
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
@@ -86,38 +87,35 @@
#define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
-///////////////
-// Still to be implemented
-//#define CHECK_NOFAIL( expr ) // !TBD - reports violation, but doesn't fail Test
-
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
#else
-#define REQUIRE( expr ) INTERNAL_CATCH_TEST( expr, false, true, "REQUIRE" )
-#define REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( expr, true, true, "REQUIRE_FALSE" )
+#define REQUIRE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal, "REQUIRE" )
+#define REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal | Catch::ResultDisposition::NegateResult, "REQUIRE_FALSE" )
-#define REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., true, "REQUIRE_THROWS" )
-#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, true, "REQUIRE_THROWS_AS" )
-#define REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, true, "REQUIRE_NOTHROW" )
+#define REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., Catch::ResultDisposition::Normal, "REQUIRE_THROWS" )
+#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::Normal, "REQUIRE_THROWS_AS" )
+#define REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::Normal, "REQUIRE_NOTHROW" )
-#define CHECK( expr ) INTERNAL_CATCH_TEST( expr, false, false, "CHECK" )
-#define CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( expr, true, false, "CHECK_FALSE" )
-#define CHECKED_IF( expr ) INTERNAL_CATCH_IF( expr, false, false, "CHECKED_IF" )
-#define CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, false, false, "CHECKED_ELSE" )
+#define CHECK( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECK" )
+#define CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::NegateResult, "CHECK_FALSE" )
+#define CHECKED_IF( expr ) INTERNAL_CATCH_IF( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECKED_IF" )
+#define CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECKED_ELSE" )
+#define CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CHECK_NOFAIL" )
-#define CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., false, "CHECK_THROWS" )
-#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, false, "CHECK_THROWS_AS" )
-#define CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, false, "CHECK_NOTHROW" )
+#define CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, ..., Catch::ResultDisposition::ContinueOnFailure, "CHECK_THROWS" )
+#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CHECK_THROWS_AS" )
+#define CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECK_NOTHROW" )
-#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, false, "CHECK_THAT" )
-#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, true, "REQUIRE_THAT" )
+#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CHECK_THAT" )
+#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "REQUIRE_THAT" )
-#define INFO( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Info, false, "INFO" )
-#define WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, false, "WARN" )
-#define FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, true, "FAIL" )
-#define SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, false, "SUCCEED" )
+#define INFO( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Info, Catch::ResultDisposition::ContinueOnFailure, "INFO" )
+#define WARN( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "WARN" )
+#define FAIL( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL" )
+#define SUCCEED( msg ) INTERNAL_CATCH_MSG( msg, Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED" )
#define SCOPED_INFO( msg ) INTERNAL_CATCH_SCOPED_INFO( msg, "SCOPED_INFO" )
-#define CAPTURE( msg ) INTERNAL_CATCH_MSG( #msg " := " << msg, Catch::ResultWas::Info, false, "CAPTURE" )
+#define CAPTURE( msg ) INTERNAL_CATCH_MSG( #msg " := " << msg, Catch::ResultWas::Info, Catch::ResultDisposition::ContinueOnFailure, "CAPTURE" )
#define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_SCOPED_INFO( #msg " := " << msg, "SCOPED_CAPTURE" )
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h
index b3baff2e..37372b67 100644
--- a/include/internal/catch_assertionresult.h
+++ b/include/internal/catch_assertionresult.h
@@ -16,18 +16,15 @@ namespace Catch {
struct AssertionInfo
{
AssertionInfo() {}
- AssertionInfo( const std::string& _macroName, const SourceLineInfo& _lineInfo, const std::string& _capturedExpression, bool _shouldNegate )
- : macroName( _macroName ),
- lineInfo( _lineInfo ),
- capturedExpression( _capturedExpression )
- {
- if( _shouldNegate )
- capturedExpression = "!" + _capturedExpression;
- }
+ AssertionInfo( const std::string& _macroName,
+ const SourceLineInfo& _lineInfo,
+ const std::string& _capturedExpression,
+ ResultDisposition::Flags _resultDisposition );
std::string macroName;
SourceLineInfo lineInfo;
std::string capturedExpression;
+ ResultDisposition::Flags resultDisposition;
};
struct AssertionResultData
@@ -45,7 +42,8 @@ namespace Catch {
AssertionResult( const AssertionInfo& info, const AssertionResultData& data );
~AssertionResult();
- bool ok() const;
+ bool isOk() const;
+ bool succeeded() const;
ResultWas::OfType getResultType() const;
bool hasExpression() const;
bool hasMessage() const;
diff --git a/include/internal/catch_assertionresult.hpp b/include/internal/catch_assertionresult.hpp
index f1ef9d18..91853307 100644
--- a/include/internal/catch_assertionresult.hpp
+++ b/include/internal/catch_assertionresult.hpp
@@ -12,6 +12,20 @@
namespace Catch {
+
+ AssertionInfo::AssertionInfo( const std::string& _macroName,
+ const SourceLineInfo& _lineInfo,
+ const std::string& _capturedExpression,
+ ResultDisposition::Flags _resultDisposition )
+ : macroName( _macroName ),
+ lineInfo( _lineInfo ),
+ capturedExpression( _capturedExpression ),
+ resultDisposition( _resultDisposition )
+ {
+ if( shouldNegate( resultDisposition ) )
+ capturedExpression = "!" + _capturedExpression;
+ }
+
AssertionResult::AssertionResult() {}
AssertionResult::AssertionResult( const AssertionInfo& info, const AssertionResultData& data )
@@ -21,8 +35,14 @@ namespace Catch {
AssertionResult::~AssertionResult() {}
- bool AssertionResult::ok() const {
- return isOk( m_resultData.resultType );
+ // Result was a success
+ bool AssertionResult::succeeded() const {
+ return Catch::isOk( m_resultData.resultType );
+ }
+
+ // Result was a success, or failure is suppressed
+ bool AssertionResult::isOk() const {
+ return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );
}
ResultWas::OfType AssertionResult::getResultType() const {
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp
index 484383c5..e2919848 100644
--- a/include/internal/catch_capture.hpp
+++ b/include/internal/catch_capture.hpp
@@ -74,7 +74,7 @@ public:
private:
ExpressionResultBuilder m_resultBuilder;
};
-
+
// This is just here to avoid compiler warnings with macro constants and boolean literals
inline bool isTrue( bool value ){ return value; }
@@ -84,109 +84,113 @@ inline bool isTrue( bool value ){ return value; }
#define INTERNAL_CATCH_ASSERTIONINFO_NAME INTERNAL_CATCH_UNIQUE_NAME( __assertionInfo )
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_ACCEPT_EXPR( evaluatedExpr, stopOnFailure, originalExpr ) \
+#define INTERNAL_CATCH_ACCEPT_EXPR( evaluatedExpr, resultDisposition, originalExpr ) \
if( Catch::ResultAction::Value internal_catch_action = Catch::getResultCapture().acceptExpression( evaluatedExpr, INTERNAL_CATCH_ASSERTIONINFO_NAME ) ) { \
if( internal_catch_action & Catch::ResultAction::Debug ) BreakIntoDebugger(); \
if( internal_catch_action & Catch::ResultAction::Abort ) throw Catch::TestFailureException(); \
- if( Catch::isTrue( stopOnFailure ) ) throw Catch::TestFailureException(); \
+ if( !Catch::shouldContinueOnFailure( resultDisposition ) ) throw Catch::TestFailureException(); \
if( Catch::isTrue( false ) ){ bool this_is_here_to_invoke_warnings = ( originalExpr ); Catch::isTrue( this_is_here_to_invoke_warnings ); } \
}
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_ACCEPT_INFO( expr, macroName, shouldNegate ) \
- Catch::AssertionInfo INTERNAL_CATCH_ASSERTIONINFO_NAME( macroName, CATCH_INTERNAL_LINEINFO, expr, shouldNegate );
-// !TBD Catch::getResultCapture().acceptAssertionInfo( INTERNAL_CATCH_ASSERTIONINFO_NAME )
+#define INTERNAL_CATCH_ACCEPT_INFO( expr, macroName, resultDisposition ) \
+ Catch::AssertionInfo INTERNAL_CATCH_ASSERTIONINFO_NAME( macroName, CATCH_INTERNAL_LINEINFO, expr, resultDisposition );
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_TEST( expr, shouldNegate, stopOnFailure, macroName ) \
+#define INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ) \
do { \
- INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, shouldNegate ); \
+ INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, resultDisposition ); \
try { \
- INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionDecomposer()->*expr ).negate( shouldNegate ), stopOnFailure, expr ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionDecomposer()->*expr ).endExpression( resultDisposition ), resultDisposition, expr ); \
} catch( Catch::TestFailureException& ) { \
throw; \
} catch( ... ) { \
- INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException(), false, expr ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException(), \
+ resultDisposition | Catch::ResultDisposition::ContinueOnFailure, expr ); \
throw; \
} \
} while( Catch::isTrue( false ) )
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_IF( expr, shouldNegate, stopOnFailure, macroName ) \
- INTERNAL_CATCH_TEST( expr, shouldNegate, stopOnFailure, macroName ); \
- if( Catch::getResultCapture().getLastResult()->ok() )
+#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
+ INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \
+ if( Catch::getResultCapture().getLastResult()->succeeded() )
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_ELSE( expr, shouldNegate, stopOnFailure, macroName ) \
- INTERNAL_CATCH_TEST( expr, shouldNegate, stopOnFailure, macroName ); \
- if( !Catch::getResultCapture().getLastResult()->ok() )
+#define INTERNAL_CATCH_ELSE( expr, resultDisposition, macroName ) \
+ INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \
+ if( !Catch::getResultCapture().getLastResult()->succeeded() )
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_NO_THROW( expr, stopOnFailure, macroName ) \
+#define INTERNAL_CATCH_NO_THROW( expr, resultDisposition, macroName ) \
do { \
- INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, false ); \
+ INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, resultDisposition ); \
try { \
expr; \
- INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::Ok ), stopOnFailure, false ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::Ok ), resultDisposition, false ); \
} \
catch( ... ) { \
- INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException(), stopOnFailure, false ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException(), resultDisposition, false ); \
} \
} while( Catch::isTrue( false ) )
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_THROWS_IMPL( expr, exceptionType, stopOnFailure ) \
+#define INTERNAL_CATCH_THROWS_IMPL( expr, exceptionType, resultDisposition ) \
try { \
if( Catch::getCurrentContext().getConfig()->allowThrows() ) { \
expr; \
- INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::DidntThrowException ), stopOnFailure, false ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::DidntThrowException ), resultDisposition, false ); \
} \
} \
catch( Catch::TestFailureException& ) { \
throw; \
} \
catch( exceptionType ) { \
- INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::Ok ), stopOnFailure, false ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::Ok ), resultDisposition, false ); \
}
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_THROWS( expr, exceptionType, stopOnFailure, macroName ) \
+#define INTERNAL_CATCH_THROWS( expr, exceptionType, resultDisposition, macroName ) \
do { \
- INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, false ); \
- INTERNAL_CATCH_THROWS_IMPL( expr, exceptionType, stopOnFailure ) \
+ INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, resultDisposition ); \
+ INTERNAL_CATCH_THROWS_IMPL( expr, exceptionType, resultDisposition ) \
} while( Catch::isTrue( false ) )
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, stopOnFailure, macroName ) \
+#define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, resultDisposition, macroName ) \
do { \
- INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, false ); \
- INTERNAL_CATCH_THROWS_IMPL( expr, exceptionType, stopOnFailure ) \
+ INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, resultDisposition ); \
+ INTERNAL_CATCH_THROWS_IMPL( expr, exceptionType, resultDisposition ) \
catch( ... ) { \
- INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException() ), stopOnFailure, false ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException() ), \
+ resultDisposition | Catch::ResultDisposition::ContinueOnFailure, false ); \
} \
} while( Catch::isTrue( false ) )
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \
- INTERNAL_CATCH_ACCEPT_INFO( "", macroName, false ); \
- INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( resultType ) << reason, stopOnFailure, true );
+#define INTERNAL_CATCH_MSG( reason, resultType, resultDisposition, macroName ) \
+ do { \
+ INTERNAL_CATCH_ACCEPT_INFO( "", macroName, resultDisposition ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( resultType ) << reason, resultDisposition, true ) \
+ } while( Catch::isTrue( false ) )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_SCOPED_INFO( log, macroName ) \
- INTERNAL_CATCH_ACCEPT_INFO( "", macroName, false ); \
+ INTERNAL_CATCH_ACCEPT_INFO( "", macroName, Catch::ResultDisposition::Normal ); \
Catch::ScopedInfo INTERNAL_CATCH_UNIQUE_NAME( info ); \
INTERNAL_CATCH_UNIQUE_NAME( info ) << log
///////////////////////////////////////////////////////////////////////////////
-#define INTERNAL_CHECK_THAT( arg, matcher, stopOnFailure, macroName ) \
+#define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \
do { \
- INTERNAL_CATCH_ACCEPT_INFO( #arg " " #matcher, macroName, false ); \
+ INTERNAL_CATCH_ACCEPT_INFO( #arg " " #matcher, macroName, resultDisposition ); \
try { \
- INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::expressionResultBuilderFromMatcher( ::Catch::Matchers::matcher, arg, #matcher ) ), stopOnFailure, false ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::expressionResultBuilderFromMatcher( ::Catch::Matchers::matcher, arg, #matcher ) ), resultDisposition, false ); \
} catch( Catch::TestFailureException& ) { \
throw; \
} catch( ... ) { \
- INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException() ), false, false ); \
+ INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException() ), \
+ resultDisposition | Catch::ResultDisposition::ContinueOnFailure, false ); \
throw; \
} \
} while( Catch::isTrue( false ) )
diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp
index f03ae3c8..4df98531 100644
--- a/include/internal/catch_commandline.hpp
+++ b/include/internal/catch_commandline.hpp
@@ -282,7 +282,14 @@ namespace Catch {
// subsequently wrapped lines
virtual std::string optionDescription() const {
return
- "!TBD";
+ "This option allows one or more tags or tag patterns to be specified.\n"
+ "Each tag is enclosed in square brackets. A series of tags form an AND expression "
+ "wheras a comma seperated sequence forms an OR expression. e.g.:\n\n"
+ " -g [one][two],[three]\n\n"
+ "This matches all tests tagged [one] and [two], as well as all tests tagged [three].\n\n"
+ "Tags can be negated with the ~ character. This removes matching tests from the set. e.g.:\n\n"
+ " -g [one]~[two]\n\n"
+ "matches all tests tagged [one], except those also tagged [two]";
}
virtual void parseIntoConfig( const Command& cmd, ConfigData& config ) {
diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h
index cac5d112..41573556 100644
--- a/include/internal/catch_common.h
+++ b/include/internal/catch_common.h
@@ -94,7 +94,7 @@ namespace Catch {
friend std::ostream& operator << ( std::ostream& os, const pluralise& pluraliser ) {
os << pluraliser.m_count << " " << pluraliser.m_label;
if( pluraliser.m_count != 1 )
- os << "s";
+ os << "s";
return os;
}
@@ -109,24 +109,17 @@ namespace Catch {
: file( _file ),
line( _line )
{}
- SourceLineInfo( const std::string& _function, const std::string& _file, std::size_t _line )
- : function( _function ),
- file( _file ),
- line( _line )
- {}
SourceLineInfo( const SourceLineInfo& other )
: file( other.file ),
line( other.line )
{}
- void swap( SourceLineInfo& other ){
- file.swap( other.file );
- std::swap( line, other.line );
+ bool empty() const {
+ re