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

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/UsageTests
diff options
context:
space:
mode:
authorJozef Grajciar2021-05-10 21:42:47 +0200
committerGitHub2021-05-10 21:42:47 +0200
commiteb911aa995d806a5989cc026df7e8b69c470c4c8 (patch)
tree44eb7fbc99a31af22c9aab72f66fd4c6b2da1f97 /tests/SelfTest/UsageTests
parent313071e8fee34bc96c98f0fa3c4065f39ed63236 (diff)
downloadcatch3-eb911aa995d806a5989cc026df7e8b69c470c4c8.tar.gz
Suppress failure of CHECKED_IF and CHECKED_ELSE (#2187)
Resolves #1390 Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
Diffstat (limited to 'tests/SelfTest/UsageTests')
-rw-r--r--tests/SelfTest/UsageTests/Misc.tests.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp
index 277723a8..5dfef6b1 100644
--- a/tests/SelfTest/UsageTests/Misc.tests.cpp
+++ b/tests/SelfTest/UsageTests/Misc.tests.cpp
@@ -182,6 +182,39 @@ TEST_CASE( "checkedElse, failing", "[failing][.]" ) {
REQUIRE( testCheckedElse( false ) );
}
+TEST_CASE("Testing checked-if", "[checked-if]") {
+ CHECKED_IF(true) {
+ SUCCEED();
+ }
+ CHECKED_IF(false) {
+ FAIL();
+ }
+ CHECKED_ELSE(true) {
+ FAIL();
+ }
+ CHECKED_ELSE(false) {
+ SUCCEED();
+ }
+}
+
+TEST_CASE("Testing checked-if 2", "[checked-if][!shouldfail]") {
+ CHECKED_IF(true) {
+ FAIL();
+ }
+ // If the checked if is not entered, this passes and the test
+ // fails, because of the [!shouldfail] tag.
+ SUCCEED();
+}
+
+TEST_CASE("Testing checked-if 3", "[checked-if][!shouldfail]") {
+ CHECKED_ELSE(false) {
+ FAIL();
+ }
+ // If the checked false is not entered, this passes and the test
+ // fails, because of the [!shouldfail] tag.
+ SUCCEED();
+}
+
TEST_CASE( "xmlentitycheck" ) {
SECTION( "embedded xml: <test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>" ) {
SUCCEED(); // We need this here to stop it failing due to no tests