catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Workaround libstdc++-4.8 regex issue in approval tests
- Commit
9796846ad02489b05113f815b88226112ae06be8- Author
- Martin Hořeňovský ·
- Parents
74d3dfd4cc45
Changes
.../SelfTest/Baselines/console.std.approved.txt | 2 +- .../SelfTest/Baselines/console.sw.approved.txt | 37 +----------------- projects/SelfTest/Baselines/junit.sw.approved.txt | 2 +- projects/SelfTest/Baselines/xml.sw.approved.txt | 44 +--------------------- projects/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:<line number>: -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:<line number>: -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:<line number>: -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:<line number>: -PASSED: - REQUIRE_THAT( testStringForMatching(), Matches("^.* 'abc' .*$") ) -with expansion: - "this string contains 'abc' as a substring" matches "^.* 'abc' .*$" case - sensitively - -Matchers.tests.cpp:<line number>: -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 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="15" failures="92" tests="957" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="15" failures="92" tests="952" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1027" time="{duration}"/> 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) </Expanded> </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > - <Original> - testStringForMatching(), Matches("this string contains 'abc' as a substring") - </Original> - <Expanded> - "this string contains 'abc' as a substring" matches "this string contains 'abc' as a substring" case sensitively - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > - <Original> - testStringForMatching(), Matches("this string CONTAINS 'abc' as a substring", Catch::CaseSensitive::No) - </Original> - <Expanded> - "this string contains 'abc' as a substring" matches "this string CONTAINS 'abc' as a substring" case insensitively - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > - <Original> - testStringForMatching(), Matches("^this string contains 'abc' as a substring$") - </Original> - <Expanded> - "this string contains 'abc' as a substring" matches "^this string contains 'abc' as a substring$" case sensitively - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > - <Original> - testStringForMatching(), Matches("^.* 'abc' .*$") - </Original> - <Expanded> - "this string contains 'abc' as a substring" matches "^.* 'abc' .*$" case sensitively - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > - <Original> - testStringForMatching(), Matches("^.* 'ABC' .*$", Catch::CaseSensitive::No) - </Original> - <Expanded> - "this string contains 'abc' as a substring" matches "^.* 'ABC' .*$" case insensitively - </Expanded> - </Expression> <OverallResult success="true"/> </TestCase> <TestCase name="StringRef" tags="[Strings]" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -8903,7 +8863,7 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="829" failures="107" expectedFailures="21"/> + <OverallResults successes="824" failures="107" expectedFailures="21"/> </Group> - <OverallResults successes="829" failures="106" expectedFailures="21"/> + <OverallResults successes="824" failures="106" expectedFailures="21"/> </Catch> 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 ) ); } +// <regex> 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"));