From 9796846ad02489b05113f815b88226112ae06be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 13 Nov 2017 18:19:40 +0100 Subject: [PATCH] Workaround libstdc++-4.8 regex issue in approval tests --- .../Baselines/console.std.approved.txt | 2 +- .../Baselines/console.sw.approved.txt | 37 +--------------- .../SelfTest/Baselines/junit.sw.approved.txt | 2 +- .../SelfTest/Baselines/xml.sw.approved.txt | 44 +------------------ .../SelfTest/UsageTests/Matchers.tests.cpp | 15 ++++--- 5 files changed, 14 insertions(+), 86 deletions(-) diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 643f91da..da7b0038 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1053,5 +1053,5 @@ with expansion: =============================================================================== test cases: 189 | 137 passed | 48 failed | 4 failed as expected -assertions: 957 | 833 passed | 103 failed | 21 failed as expected +assertions: 952 | 828 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 fa7d62c9..9986fd33 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -4730,41 +4730,6 @@ with expansion: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) -Matchers.tests.cpp:: -PASSED: - REQUIRE_THAT( testStringForMatching(), Matches("this string contains 'abc' as a substring") ) -with expansion: - "this string contains 'abc' as a substring" matches "this string contains - 'abc' as a substring" case sensitively - -Matchers.tests.cpp:: -PASSED: - REQUIRE_THAT( testStringForMatching(), Matches("this string CONTAINS 'abc' as a substring", Catch::CaseSensitive::No) ) -with expansion: - "this string contains 'abc' as a substring" matches "this string CONTAINS - 'abc' as a substring" case insensitively - -Matchers.tests.cpp:: -PASSED: - REQUIRE_THAT( testStringForMatching(), Matches("^this string contains 'abc' as a substring$") ) -with expansion: - "this string contains 'abc' as a substring" matches "^this string contains - 'abc' as a substring$" case sensitively - -Matchers.tests.cpp:: -PASSED: - REQUIRE_THAT( testStringForMatching(), Matches("^.* 'abc' .*$") ) -with expansion: - "this string contains 'abc' as a substring" matches "^.* 'abc' .*$" case - sensitively - -Matchers.tests.cpp:: -PASSED: - REQUIRE_THAT( testStringForMatching(), Matches("^.* 'ABC' .*$", Catch::CaseSensitive::No) ) -with expansion: - "this string contains 'abc' as a substring" matches "^.* 'ABC' .*$" case - insensitively - ------------------------------------------------------------------------------- StringRef Empty string @@ -8023,5 +7988,5 @@ PASSED: =============================================================================== test cases: 189 | 135 passed | 50 failed | 4 failed as expected -assertions: 956 | 829 passed | 106 failed | 21 failed as expected +assertions: 951 | 824 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 249529ea..913a9668 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index bbd769fb..ebb6b96f 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -5420,46 +5420,6 @@ Message from section two "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) - - - testStringForMatching(), Matches("this string contains 'abc' as a substring") - - - "this string contains 'abc' as a substring" matches "this string contains 'abc' as a substring" case sensitively - - - - - testStringForMatching(), Matches("this string CONTAINS 'abc' as a substring", Catch::CaseSensitive::No) - - - "this string contains 'abc' as a substring" matches "this string CONTAINS 'abc' as a substring" case insensitively - - - - - testStringForMatching(), Matches("^this string contains 'abc' as a substring$") - - - "this string contains 'abc' as a substring" matches "^this string contains 'abc' as a substring$" case sensitively - - - - - testStringForMatching(), Matches("^.* 'abc' .*$") - - - "this string contains 'abc' as a substring" matches "^.* 'abc' .*$" case sensitively - - - - - testStringForMatching(), Matches("^.* 'ABC' .*$", Catch::CaseSensitive::No) - - - "this string contains 'abc' as a substring" matches "^.* 'ABC' .*$" case insensitively - - @@ -8903,7 +8863,7 @@ loose text artifact - + - + diff --git a/projects/SelfTest/UsageTests/Matchers.tests.cpp b/projects/SelfTest/UsageTests/Matchers.tests.cpp index 30f1cc34..c8c0bf1c 100644 --- a/projects/SelfTest/UsageTests/Matchers.tests.cpp +++ b/projects/SelfTest/UsageTests/Matchers.tests.cpp @@ -39,12 +39,6 @@ TEST_CASE("String matchers", "[matchers]" ) { 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)); - REQUIRE_THAT(testStringForMatching(), Matches("^this string contains 'abc' as a substring$")); - REQUIRE_THAT(testStringForMatching(), Matches("^.* 'abc' .*$")); - REQUIRE_THAT(testStringForMatching(), Matches("^.* 'ABC' .*$", Catch::CaseSensitive::No)); } TEST_CASE("Contains string matcher", "[.][failing][matchers]") { @@ -72,6 +66,15 @@ TEST_CASE("Equals", "[matchers]") { CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring", Catch::CaseSensitive::No ) ); } +// does not work in libstdc++ 4.8, so we have to +TEST_CASE("Regex string matcher -- libstdc++-4.8 workaround", "[matchers][approvals]") { + 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)); + REQUIRE_THAT(testStringForMatching(), Matches("^this string contains 'abc' as a substring$")); + REQUIRE_THAT(testStringForMatching(), Matches("^.* 'abc' .*$")); + REQUIRE_THAT(testStringForMatching(), Matches("^.* 'ABC' .*$", Catch::CaseSensitive::No)); +} + TEST_CASE("Regex string matcher", "[matchers][.failing]") { CHECK_THAT( testStringForMatching(), Matches("this STRING contains 'abc' as a substring")); CHECK_THAT( testStringForMatching(), Matches("contains 'abc' as a substring"));