mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-13 00:45:39 +02:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
40f6068d52 | ||
![]() |
21cbfc107e | ||
![]() |
31861bbd46 | ||
![]() |
b1eeec7c69 | ||
![]() |
c23b374f3d | ||
![]() |
916317bd81 | ||
![]() |
8c459dd207 | ||
![]() |
c47c1797d2 | ||
![]() |
f5d2b2dce8 | ||
![]() |
02c7e41c7c | ||
![]() |
5095619955 |
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
*v1.5.6*
|
||||
*v1.5.7*
|
||||
|
||||
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
||||
|
||||
|
@@ -85,8 +85,11 @@ namespace Catch {
|
||||
std::string line;
|
||||
while( std::getline( f, line ) ) {
|
||||
line = trim(line);
|
||||
if( !line.empty() && !startsWith( line, "#" ) )
|
||||
addTestOrTags( config, "\"" + line + "\"," );
|
||||
if( !line.empty() && !startsWith( line, "#" ) ) {
|
||||
if( !startsWith( line, "\"" ) )
|
||||
line = "\"" + line + "\"";
|
||||
addTestOrTags( config, line + "," );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -68,7 +68,10 @@ namespace Catch {
|
||||
++it ) {
|
||||
matchedTests++;
|
||||
TestCaseInfo const& testCaseInfo = it->getTestCaseInfo();
|
||||
Catch::cout() << testCaseInfo.name << std::endl;
|
||||
if( startsWith( testCaseInfo.name, "#" ) )
|
||||
Catch::cout() << "\"" << testCaseInfo.name << "\"" << std::endl;
|
||||
else
|
||||
Catch::cout() << testCaseInfo.name << std::endl;
|
||||
}
|
||||
return matchedTests;
|
||||
}
|
||||
|
@@ -64,10 +64,11 @@ namespace Catch {
|
||||
|
||||
bool matches( TestCaseInfo const& testCase ) const {
|
||||
// All patterns in a filter must match for the filter to be a match
|
||||
for( std::vector<Ptr<Pattern> >::const_iterator it = m_patterns.begin(), itEnd = m_patterns.end(); it != itEnd; ++it )
|
||||
for( std::vector<Ptr<Pattern> >::const_iterator it = m_patterns.begin(), itEnd = m_patterns.end(); it != itEnd; ++it ) {
|
||||
if( !(*it)->matches( testCase ) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
return os;
|
||||
}
|
||||
|
||||
Version libraryVersion( 1, 5, 6, "", 0 );
|
||||
Version libraryVersion( 1, 5, 7, "", 0 );
|
||||
|
||||
}
|
||||
|
||||
|
@@ -55,9 +55,10 @@ namespace Catch {
|
||||
break;
|
||||
|
||||
default:
|
||||
// Escape control chars - based on contribution by @espenalb in PR #465
|
||||
// Escape control chars - based on contribution by @espenalb in PR #465 and
|
||||
// by @mrpi PR #588
|
||||
if ( ( c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' )
|
||||
os << "&#x" << std::uppercase << std::hex << static_cast<int>( c );
|
||||
os << "&#x" << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>( c ) << ';';
|
||||
else
|
||||
os << c;
|
||||
}
|
||||
@@ -112,13 +113,20 @@ namespace Catch {
|
||||
: m_tagIsOpen( false ),
|
||||
m_needsNewline( false ),
|
||||
m_os( &Catch::cout() )
|
||||
{}
|
||||
{
|
||||
// We encode control characters, which requires
|
||||
// XML 1.1
|
||||
// see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0
|
||||
*m_os << "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n";
|
||||
}
|
||||
|
||||
XmlWriter( std::ostream& os )
|
||||
: m_tagIsOpen( false ),
|
||||
m_needsNewline( false ),
|
||||
m_os( &os )
|
||||
{}
|
||||
{
|
||||
*m_os << "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n";
|
||||
}
|
||||
|
||||
~XmlWriter() {
|
||||
while( !m_tags.empty() )
|
||||
|
@@ -53,7 +53,7 @@ namespace Catch {
|
||||
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testCaseStarting(testInfo);
|
||||
m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) );
|
||||
m_xml.startElement( "TestCase" ).writeAttribute( "name", testInfo.name );
|
||||
|
||||
if ( m_config->showDurations() == ShowDurations::Always )
|
||||
m_testCaseTimer.start();
|
||||
|
@@ -830,6 +830,6 @@ with expansion:
|
||||
"first" == "second"
|
||||
|
||||
===============================================================================
|
||||
test cases: 168 | 124 passed | 42 failed | 2 failed as expected
|
||||
assertions: 920 | 824 passed | 78 failed | 18 failed as expected
|
||||
test cases: 169 | 125 passed | 42 failed | 2 failed as expected
|
||||
assertions: 921 | 825 passed | 78 failed | 18 failed as expected
|
||||
|
||||
|
@@ -3920,9 +3920,9 @@ MiscTests.cpp:<line number>
|
||||
|
||||
MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( encode( "[\x01]" ) == "[]" )
|
||||
REQUIRE( encode( "[\x01]" ) == "[]" )
|
||||
with expansion:
|
||||
"[]" == "[]"
|
||||
"[]" == "[]"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
XmlEncode
|
||||
@@ -3933,9 +3933,9 @@ MiscTests.cpp:<line number>
|
||||
|
||||
MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( encode( "[\x7F]" ) == "[]" )
|
||||
REQUIRE( encode( "[\x7F]" ) == "[]" )
|
||||
with expansion:
|
||||
"[]" == "[]"
|
||||
"[]" == "[]"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
long long
|
||||
@@ -3962,6 +3962,17 @@ PASSED:
|
||||
with message:
|
||||
oops!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
# A test name that starts with a #
|
||||
-------------------------------------------------------------------------------
|
||||
MiscTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
with message:
|
||||
yay
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Process can be configured on command line
|
||||
default - no arguments
|
||||
@@ -9104,6 +9115,6 @@ with expansion:
|
||||
1 > 0
|
||||
|
||||
===============================================================================
|
||||
test cases: 168 | 123 passed | 43 failed | 2 failed as expected
|
||||
assertions: 922 | 824 passed | 80 failed | 18 failed as expected
|
||||
test cases: 169 | 124 passed | 43 failed | 2 failed as expected
|
||||
assertions: 923 | 825 passed | 80 failed | 18 failed as expected
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.1" encoding="UTF-8"?>
|
||||
<testsuites>
|
||||
<testsuite name="CatchSelfTest" errors="13" failures="68" tests="923" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testsuite name="CatchSelfTest" errors="13" failures="68" tests="924" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
||||
@@ -500,6 +501,7 @@ MiscTests.cpp:<line number>
|
||||
<testcase classname="XmlEncode" name="string with control char (x7F)" time="{duration}"/>
|
||||
<testcase classname="global" name="long long" time="{duration}"/>
|
||||
<testcase classname="global" name="This test 'should' fail but doesn't" time="{duration}"/>
|
||||
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.1" encoding="UTF-8"?>
|
||||
<Catch name="CatchSelfTest">
|
||||
<Group name="CatchSelfTest">
|
||||
<TestCase name="toString(enum)">
|
||||
@@ -4051,10 +4052,10 @@
|
||||
<Section name="string with control char (1)">
|
||||
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/MiscTests.cpp" >
|
||||
<Original>
|
||||
encode( "[\x01]" ) == "[&#x1]"
|
||||
encode( "[\x01]" ) == "[&#x01;]"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"[&#x1]" == "[&#x1]"
|
||||
"[&#x01;]" == "[&#x01;]"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
@@ -4062,10 +4063,10 @@
|
||||
<Section name="string with control char (x7F)">
|
||||
<Expression success="true" type="REQUIRE" filename="projects/SelfTest/MiscTests.cpp" >
|
||||
<Original>
|
||||
encode( "[\x7F]" ) == "[&#x7F]"
|
||||
encode( "[\x7F]" ) == "[&#x7F;]"
|
||||
</Original>
|
||||
<Expanded>
|
||||
"[&#x7F]" == "[&#x7F]"
|
||||
"[&#x7F;]" == "[&#x7F;]"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
@@ -4088,6 +4089,9 @@
|
||||
<TestCase name="This test 'should' fail but doesn't">
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="# A test name that starts with a #">
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Process can be configured on command line">
|
||||
<Section name="default - no arguments">
|
||||
<Expression success="true" type="CHECK_NOTHROW" filename="projects/SelfTest/TestMain.cpp" >
|
||||
@@ -9566,7 +9570,7 @@ there"
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="824" failures="81" expectedFailures="18"/>
|
||||
<OverallResults successes="825" failures="81" expectedFailures="18"/>
|
||||
</Group>
|
||||
<OverallResults successes="824" failures="80" expectedFailures="18"/>
|
||||
<OverallResults successes="825" failures="80" expectedFailures="18"/>
|
||||
</Catch>
|
||||
|
@@ -406,27 +406,27 @@ TEST_CASE( "Tabs and newlines show in output", "[.][whitespace][failing]" ) {
|
||||
|
||||
|
||||
TEST_CASE( "toString on const wchar_t const pointer returns the string contents", "[toString]" ) {
|
||||
const wchar_t * const s = L"wide load";
|
||||
std::string result = Catch::toString( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
const wchar_t * const s = L"wide load";
|
||||
std::string result = Catch::toString( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
||||
TEST_CASE( "toString on const wchar_t pointer returns the string contents", "[toString]" ) {
|
||||
const wchar_t * s = L"wide load";
|
||||
std::string result = Catch::toString( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
const wchar_t * s = L"wide load";
|
||||
std::string result = Catch::toString( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
||||
TEST_CASE( "toString on wchar_t const pointer returns the string contents", "[toString]" ) {
|
||||
wchar_t * const s = const_cast<wchar_t* const>( L"wide load" );
|
||||
std::string result = Catch::toString( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
wchar_t * const s = const_cast<wchar_t* const>( L"wide load" );
|
||||
std::string result = Catch::toString( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
||||
TEST_CASE( "toString on wchar_t returns the string contents", "[toString]" ) {
|
||||
wchar_t * s = const_cast<wchar_t*>( L"wide load" );
|
||||
std::string result = Catch::toString( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
wchar_t * s = const_cast<wchar_t*>( L"wide load" );
|
||||
std::string result = Catch::toString( s );
|
||||
CHECK( result == "\"wide load\"" );
|
||||
}
|
||||
|
||||
inline std::string encode( std::string const& str, Catch::XmlEncode::ForWhat forWhat = Catch::XmlEncode::ForTextNodes ) {
|
||||
@@ -458,10 +458,10 @@ TEST_CASE( "XmlEncode" ) {
|
||||
REQUIRE( encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" );
|
||||
}
|
||||
SECTION( "string with control char (1)" ) {
|
||||
REQUIRE( encode( "[\x01]" ) == "[]" );
|
||||
REQUIRE( encode( "[\x01]" ) == "[]" );
|
||||
}
|
||||
SECTION( "string with control char (x7F)" ) {
|
||||
REQUIRE( encode( "[\x7F]" ) == "[]" );
|
||||
REQUIRE( encode( "[\x7F]" ) == "[]" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,3 +483,7 @@ TEST_CASE( "This test 'should' fail but doesn't", "[.][failing][!shouldfail]" )
|
||||
{
|
||||
SUCCEED( "oops!" );
|
||||
}
|
||||
|
||||
TEST_CASE( "# A test name that starts with a #" ) {
|
||||
SUCCEED( "yay" );
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Catch v1.5.6
|
||||
* Generated: 2016-06-09 19:20:41.460328
|
||||
* Catch v1.5.7
|
||||
* Generated: 2016-09-27 10:45:46.824849
|
||||
* ----------------------------------------------------------
|
||||
* This file has been merged from multiple headers. Please don't edit it directly
|
||||
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||
@@ -3223,10 +3223,11 @@ namespace Catch {
|
||||
|
||||
bool matches( TestCaseInfo const& testCase ) const {
|
||||
// All patterns in a filter must match for the filter to be a match
|
||||
for( std::vector<Ptr<Pattern> >::const_iterator it = m_patterns.begin(), itEnd = m_patterns.end(); it != itEnd; ++it )
|
||||
for( std::vector<Ptr<Pattern> >::const_iterator it = m_patterns.begin(), itEnd = m_patterns.end(); it != itEnd; ++it ) {
|
||||
if( !(*it)->matches( testCase ) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4719,8 +4720,11 @@ namespace Catch {
|
||||
std::string line;
|
||||
while( std::getline( f, line ) ) {
|
||||
line = trim(line);
|
||||
if( !line.empty() && !startsWith( line, "#" ) )
|
||||
addTestOrTags( config, "\"" + line + "\"," );
|
||||
if( !line.empty() && !startsWith( line, "#" ) ) {
|
||||
if( !startsWith( line, "\"" ) )
|
||||
line = "\"" + line + "\"";
|
||||
addTestOrTags( config, line + "," );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5368,7 +5372,10 @@ namespace Catch {
|
||||
++it ) {
|
||||
matchedTests++;
|
||||
TestCaseInfo const& testCaseInfo = it->getTestCaseInfo();
|
||||
Catch::cout() << testCaseInfo.name << std::endl;
|
||||
if( startsWith( testCaseInfo.name, "#" ) )
|
||||
Catch::cout() << "\"" << testCaseInfo.name << "\"" << std::endl;
|
||||
else
|
||||
Catch::cout() << testCaseInfo.name << std::endl;
|
||||
}
|
||||
return matchedTests;
|
||||
}
|
||||
@@ -7571,7 +7578,7 @@ namespace Catch {
|
||||
return os;
|
||||
}
|
||||
|
||||
Version libraryVersion( 1, 5, 6, "", 0 );
|
||||
Version libraryVersion( 1, 5, 7, "", 0 );
|
||||
|
||||
}
|
||||
|
||||
@@ -8951,9 +8958,10 @@ namespace Catch {
|
||||
break;
|
||||
|
||||
default:
|
||||
// Escape control chars - based on contribution by @espenalb in PR #465
|
||||
// Escape control chars - based on contribution by @espenalb in PR #465 and
|
||||
// by @mrpi PR #588
|
||||
if ( ( c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' )
|
||||
os << "&#x" << std::uppercase << std::hex << static_cast<int>( c );
|
||||
os << "&#x" << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>( c ) << ';';
|
||||
else
|
||||
os << c;
|
||||
}
|
||||
@@ -9008,13 +9016,20 @@ namespace Catch {
|
||||
: m_tagIsOpen( false ),
|
||||
m_needsNewline( false ),
|
||||
m_os( &Catch::cout() )
|
||||
{}
|
||||
{
|
||||
// We encode control characters, which requires
|
||||
// XML 1.1
|
||||
// see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0
|
||||
*m_os << "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n";
|
||||
}
|
||||
|
||||
XmlWriter( std::ostream& os )
|
||||
: m_tagIsOpen( false ),
|
||||
m_needsNewline( false ),
|
||||
m_os( &os )
|
||||
{}
|
||||
{
|
||||
*m_os << "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n";
|
||||
}
|
||||
|
||||
~XmlWriter() {
|
||||
while( !m_tags.empty() )
|
||||
@@ -9181,7 +9196,7 @@ namespace Catch {
|
||||
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testCaseStarting(testInfo);
|
||||
m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) );
|
||||
m_xml.startElement( "TestCase" ).writeAttribute( "name", testInfo.name );
|
||||
|
||||
if ( m_config->showDurations() == ShowDurations::Always )
|
||||
m_testCaseTimer.start();
|
||||
|
Reference in New Issue
Block a user