diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index fcc7a7c5..8fab7581 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -145,9 +145,15 @@ MatchersTests.cpp: ............................................................................... MatchersTests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Contains( "not there" ) ) + CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) with expansion: - "this string contains 'abc' as a substring" contains: "not there" + "this string contains 'abc' as a substring" contains: "not there" (case + insensitive) + +MatchersTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "STRING" ------------------------------------------------------------------------------- Custom exceptions can be translated when testing for nothrow @@ -188,9 +194,15 @@ MatchersTests.cpp: ............................................................................... MatchersTests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), EndsWith( "this" ) ) + CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: - "this string contains 'abc' as a substring" ends with: "this" + "this string contains 'abc' as a substring" ends with: "Substring" + +MatchersTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "this" (case + insensitive) ------------------------------------------------------------------------------- Equality checks that should fail @@ -270,9 +282,16 @@ MatchersTests.cpp: ............................................................................... MatchersTests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Equals( "something else" ) ) + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ) with expansion: - "this string contains 'abc' as a substring" equals: "something else" + "this string contains 'abc' as a substring" equals: "this string contains + 'ABC' as a substring" + +MatchersTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" equals: "something else" (case + insensitive) ------------------------------------------------------------------------------- Exception matchers that fail @@ -690,9 +709,15 @@ MatchersTests.cpp: ............................................................................... MatchersTests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith( "string" ) ) + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: - "this string contains 'abc' as a substring" starts with: "string" + "this string contains 'abc' as a substring" starts with: "This String" + +MatchersTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "string" (case + insensitive) ------------------------------------------------------------------------------- Tabs and newlines show in output @@ -1027,6 +1052,6 @@ with expansion: "{?}" == "1" =============================================================================== -test cases: 189 | 137 passed | 48 failed | 4 failed as expected -assertions: 948 | 828 passed | 99 failed | 21 failed as expected +test cases: 189 | 137 passed | 48 failed | 4 failed as expected +assertions: 957 | 833 passed | 103 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 5fbc73f1..a20ff716 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -1315,9 +1315,15 @@ MatchersTests.cpp: ............................................................................... MatchersTests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Contains( "not there" ) ) + CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ) with expansion: - "this string contains 'abc' as a substring" contains: "not there" + "this string contains 'abc' as a substring" contains: "not there" (case + insensitive) + +MatchersTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching(), Contains( "STRING" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "STRING" ------------------------------------------------------------------------------- Custom exceptions can be translated when testing for nothrow @@ -1376,9 +1382,15 @@ MatchersTests.cpp: ............................................................................... MatchersTests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), EndsWith( "this" ) ) + CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: - "this string contains 'abc' as a substring" ends with: "this" + "this string contains 'abc' as a substring" ends with: "Substring" + +MatchersTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "this" (case + insensitive) ------------------------------------------------------------------------------- Epsilon only applies to Approx's value @@ -1524,6 +1536,13 @@ with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" +MatchersTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" equals: "this string contains + 'abc' as a substring" (case insensitive) + ------------------------------------------------------------------------------- Equals string matcher ------------------------------------------------------------------------------- @@ -1531,9 +1550,16 @@ MatchersTests.cpp: ............................................................................... MatchersTests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), Equals( "something else" ) ) + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ) with expansion: - "this string contains 'abc' as a substring" equals: "something else" + "this string contains 'abc' as a substring" equals: "this string contains + 'ABC' as a substring" + +MatchersTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" equals: "something else" (case + insensitive) ------------------------------------------------------------------------------- Exception matchers that fail @@ -4636,9 +4662,15 @@ MatchersTests.cpp: ............................................................................... MatchersTests.cpp:: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith( "string" ) ) + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: - "this string contains 'abc' as a substring" starts with: "string" + "this string contains 'abc' as a substring" starts with: "This String" + +MatchersTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "string" (case + insensitive) ------------------------------------------------------------------------------- String matchers @@ -4652,24 +4684,52 @@ PASSED: with expansion: "this string contains 'abc' as a substring" contains: "string" +MatchersTests.cpp:: +PASSED: + REQUIRE_THAT( testStringForMatching(), Contains( "string", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "string" (case + insensitive) + MatchersTests.cpp:: PASSED: CHECK_THAT( testStringForMatching(), Contains( "abc" ) ) with expansion: "this string contains 'abc' as a substring" contains: "abc" +MatchersTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching(), Contains( "aBC", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "abc" (case insensitive) + insensitive) + MatchersTests.cpp:: PASSED: CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "this" +MatchersTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "this" (case + insensitive) + MatchersTests.cpp:: PASSED: CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "substring" +MatchersTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: " substring" (case + insensitive) + MatchersTests.cpp:: PASSED: REQUIRE_THAT( testStringForMatching(), Matches("this string contains 'abc' as a substring") ) @@ -7963,5 +8023,5 @@ PASSED: =============================================================================== test cases: 189 | 135 passed | 50 failed | 4 failed as expected -assertions: 947 | 824 passed | 102 failed | 21 failed as expected +assertions: 956 | 829 passed | 106 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 8bad0b8f..97adb60b 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -126,7 +126,10 @@ ExceptionTests.cpp: - + +MatchersTests.cpp: + + MatchersTests.cpp: @@ -150,7 +153,10 @@ ExceptionTests.cpp: - + +MatchersTests.cpp: + + MatchersTests.cpp: @@ -199,7 +205,10 @@ ConditionTests.cpp: - + +MatchersTests.cpp: + + MatchersTests.cpp: @@ -518,7 +527,10 @@ Message from section two - + +MatchersTests.cpp: + + MatchersTests.cpp: diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index cdcaedf7..d14dd1d2 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -1469,10 +1469,18 @@ - testStringForMatching(), Contains( "not there" ) + testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) - "this string contains 'abc' as a substring" contains: "not there" + "this string contains 'abc' as a substring" contains: "not there" (case insensitive) + + + + + testStringForMatching(), Contains( "STRING" ) + + + "this string contains 'abc' as a substring" contains: "STRING" @@ -1533,10 +1541,18 @@ - testStringForMatching(), EndsWith( "this" ) + testStringForMatching(), EndsWith( "Substring" ) - "this string contains 'abc' as a substring" ends with: "this" + "this string contains 'abc' as a substring" ends with: "Substring" + + + + + testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" ends with: "this" (case insensitive) @@ -1727,15 +1743,31 @@ "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" + + + testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) + + - testStringForMatching(), Equals( "something else" ) + testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) - "this string contains 'abc' as a substring" equals: "something else" + "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" + + + + + testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" equals: "something else" (case insensitive) @@ -5307,10 +5339,18 @@ Message from section two - testStringForMatching(), StartsWith( "string" ) + testStringForMatching(), StartsWith( "This String" ) - "this string contains 'abc' as a substring" starts with: "string" + "this string contains 'abc' as a substring" starts with: "This String" + + + + + testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" starts with: "string" (case insensitive) @@ -5324,6 +5364,14 @@ Message from section two "this string contains 'abc' as a substring" contains: "string" + + + testStringForMatching(), Contains( "string", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" contains: "string" (case insensitive) + + testStringForMatching(), Contains( "abc" ) @@ -5332,6 +5380,14 @@ Message from section two "this string contains 'abc' as a substring" contains: "abc" + + + testStringForMatching(), Contains( "aBC", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" contains: "abc" (case insensitive) + + testStringForMatching(), StartsWith( "this" ) @@ -5340,6 +5396,14 @@ Message from section two "this string contains 'abc' as a substring" starts with: "this" + + + testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" starts with: "this" (case insensitive) + + testStringForMatching(), EndsWith( "substring" ) @@ -5348,6 +5412,14 @@ Message from section two "this string contains 'abc' as a substring" ends with: "substring" + + + testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No ) + + + "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) + + testStringForMatching(), Matches("this string contains 'abc' as a substring") @@ -8831,7 +8903,7 @@ loose text artifact - + - + diff --git a/projects/SelfTest/MatchersTests.cpp b/projects/SelfTest/MatchersTests.cpp index 9a992b73..30f1cc34 100644 --- a/projects/SelfTest/MatchersTests.cpp +++ b/projects/SelfTest/MatchersTests.cpp @@ -29,13 +29,16 @@ inline const char* testStringForMatching2() using namespace Catch::Matchers; -TEST_CASE("String matchers", "[matchers]" ) -{ +TEST_CASE("String matchers", "[matchers]" ) { REQUIRE_THAT( testStringForMatching(), Contains( "string" ) ); + REQUIRE_THAT( testStringForMatching(), Contains( "string", Catch::CaseSensitive::No )); CHECK_THAT( testStringForMatching(), Contains( "abc" ) ); + CHECK_THAT( testStringForMatching(), Contains( "aBC", Catch::CaseSensitive::No )); CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ); + CHECK_THAT( testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No )); CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ); + CHECK_THAT( testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No )); REQUIRE_THAT(testStringForMatching(), Matches("this string contains 'abc' as a substring")); REQUIRE_THAT(testStringForMatching(), Matches("this string CONTAINS 'abc' as a substring", Catch::CaseSensitive::No)); @@ -44,29 +47,29 @@ TEST_CASE("String matchers", "[matchers]" ) REQUIRE_THAT(testStringForMatching(), Matches("^.* 'ABC' .*$", Catch::CaseSensitive::No)); } -TEST_CASE("Contains string matcher", "[.][failing][matchers]") -{ - CHECK_THAT( testStringForMatching(), Contains( "not there" ) ); +TEST_CASE("Contains string matcher", "[.][failing][matchers]") { + CHECK_THAT( testStringForMatching(), Contains( "not there", Catch::CaseSensitive::No ) ); + CHECK_THAT( testStringForMatching(), Contains( "STRING" )); } -TEST_CASE("StartsWith string matcher", "[.][failing][matchers]") -{ - CHECK_THAT( testStringForMatching(), StartsWith( "string" ) ); +TEST_CASE("StartsWith string matcher", "[.][failing][matchers]") { + CHECK_THAT( testStringForMatching(), StartsWith( "This String" )); + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ); } -TEST_CASE("EndsWith string matcher", "[.][failing][matchers]") -{ - CHECK_THAT( testStringForMatching(), EndsWith( "this" ) ); +TEST_CASE("EndsWith string matcher", "[.][failing][matchers]") { + CHECK_THAT( testStringForMatching(), EndsWith( "Substring" )); + CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ); } -TEST_CASE("Equals string matcher", "[.][failing][matchers]") -{ - CHECK_THAT( testStringForMatching(), Equals( "something else" ) ); +TEST_CASE("Equals string matcher", "[.][failing][matchers]") { + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ); + CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No )); } -TEST_CASE("Equals", "[matchers]") -{ - CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) ); +TEST_CASE("Equals", "[matchers]") { + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" )); + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) ); } TEST_CASE("Regex string matcher", "[matchers][.failing]") {