Workaround libstdc++-4.8 regex issue in approval tests

This commit is contained in:
Martin Hořeňovský 2017-11-13 18:19:40 +01:00
parent 74d3dfd4cc
commit 9796846ad0
5 changed files with 14 additions and 86 deletions

View File

@ -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

View File

@ -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

View File

@ -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}"/>

View File

@ -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>

View File

@ -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"));