mirror of https://github.com/catchorg/Catch2.git
Fixed inconsistent and trailing whitespace
This means that all tabs used in indentation are now 4 spaces and that there should be no more trailing whitespace. Ill also look into creating a pre-commit hook that will prevent this from happening in the future. Fixes #105
This commit is contained in:
parent
60a9ac7e65
commit
c390c4cb9f
|
@ -90,12 +90,12 @@ std::string toString( char* const value ) {
|
||||||
|
|
||||||
std::string toString( const wchar_t* const value )
|
std::string toString( const wchar_t* const value )
|
||||||
{
|
{
|
||||||
return value ? Catch::toString( std::wstring(value) ) : std::string( "{null string}" );
|
return value ? Catch::toString( std::wstring(value) ) : std::string( "{null string}" );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string toString( wchar_t* const value )
|
std::string toString( wchar_t* const value )
|
||||||
{
|
{
|
||||||
return Catch::toString( static_cast<const wchar_t*>( value ) );
|
return Catch::toString( static_cast<const wchar_t*>( value ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string toString( int value ) {
|
std::string toString( int value ) {
|
||||||
|
|
|
@ -108,12 +108,12 @@ namespace Catch {
|
||||||
|
|
||||||
struct BySectionInfo {
|
struct BySectionInfo {
|
||||||
BySectionInfo( SectionInfo const& other ) : m_other( other ) {}
|
BySectionInfo( SectionInfo const& other ) : m_other( other ) {}
|
||||||
BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {}
|
BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {}
|
||||||
bool operator() ( Ptr<SectionNode> const& node ) const {
|
bool operator() ( Ptr<SectionNode> const& node ) const {
|
||||||
return node->stats.sectionInfo.lineInfo == m_other.lineInfo;
|
return node->stats.sectionInfo.lineInfo == m_other.lineInfo;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void operator=( BySectionInfo const& );
|
void operator=( BySectionInfo const& );
|
||||||
SectionInfo const& m_other;
|
SectionInfo const& m_other;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace Catch {
|
||||||
if( assertionResult.hasExpression() ) {
|
if( assertionResult.hasExpression() ) {
|
||||||
m_xml.startElement( "Expression" )
|
m_xml.startElement( "Expression" )
|
||||||
.writeAttribute( "success", assertionResult.succeeded() )
|
.writeAttribute( "success", assertionResult.succeeded() )
|
||||||
.writeAttribute( "type", assertionResult.getTestMacroName() )
|
.writeAttribute( "type", assertionResult.getTestMacroName() )
|
||||||
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
.writeAttribute( "filename", assertionResult.getSourceInfo().file )
|
||||||
.writeAttribute( "line", assertionResult.getSourceInfo().line );
|
.writeAttribute( "line", assertionResult.getSourceInfo().line );
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,10 @@ struct Fixture
|
||||||
}
|
}
|
||||||
|
|
||||||
SCENARIO_METHOD(Fixture,
|
SCENARIO_METHOD(Fixture,
|
||||||
"BDD tests requiring Fixtures to provide commonly-accessed data or methods",
|
"BDD tests requiring Fixtures to provide commonly-accessed data or methods",
|
||||||
"[bdd][fixtures]") {
|
"[bdd][fixtures]") {
|
||||||
const int before(counter());
|
const int before(counter());
|
||||||
GIVEN("No operations precede me") {
|
GIVEN("No operations precede me") {
|
||||||
REQUIRE(before == 0);
|
REQUIRE(before == 0);
|
||||||
WHEN("We get the count") {
|
WHEN("We get the count") {
|
||||||
const int after(counter());
|
const int after(counter());
|
||||||
|
|
|
@ -210,29 +210,29 @@ TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigne
|
||||||
|
|
||||||
TEST_CASE( "comparisons between int variables", "" )
|
TEST_CASE( "comparisons between int variables", "" )
|
||||||
{
|
{
|
||||||
long long_var = 1L;
|
long long_var = 1L;
|
||||||
unsigned char unsigned_char_var = 1;
|
unsigned char unsigned_char_var = 1;
|
||||||
unsigned short unsigned_short_var = 1;
|
unsigned short unsigned_short_var = 1;
|
||||||
unsigned int unsigned_int_var = 1;
|
unsigned int unsigned_int_var = 1;
|
||||||
unsigned long unsigned_long_var = 1L;
|
unsigned long unsigned_long_var = 1L;
|
||||||
|
|
||||||
REQUIRE( long_var == unsigned_char_var );
|
REQUIRE( long_var == unsigned_char_var );
|
||||||
REQUIRE( long_var == unsigned_short_var );
|
REQUIRE( long_var == unsigned_short_var );
|
||||||
REQUIRE( long_var == unsigned_int_var );
|
REQUIRE( long_var == unsigned_int_var );
|
||||||
REQUIRE( long_var == unsigned_long_var );
|
REQUIRE( long_var == unsigned_long_var );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "comparisons between const int variables", "" )
|
TEST_CASE( "comparisons between const int variables", "" )
|
||||||
{
|
{
|
||||||
const unsigned char unsigned_char_var = 1;
|
const unsigned char unsigned_char_var = 1;
|
||||||
const unsigned short unsigned_short_var = 1;
|
const unsigned short unsigned_short_var = 1;
|
||||||
const unsigned int unsigned_int_var = 1;
|
const unsigned int unsigned_int_var = 1;
|
||||||
const unsigned long unsigned_long_var = 1L;
|
const unsigned long unsigned_long_var = 1L;
|
||||||
|
|
||||||
REQUIRE( unsigned_char_var == 1 );
|
REQUIRE( unsigned_char_var == 1 );
|
||||||
REQUIRE( unsigned_short_var == 1 );
|
REQUIRE( unsigned_short_var == 1 );
|
||||||
REQUIRE( unsigned_int_var == 1 );
|
REQUIRE( unsigned_int_var == 1 );
|
||||||
REQUIRE( unsigned_long_var == 1 );
|
REQUIRE( unsigned_long_var == 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "Comparisons between unsigned ints and negative signed ints match c++ standard behaviour", "" )
|
TEST_CASE( "Comparisons between unsigned ints and negative signed ints match c++ standard behaviour", "" )
|
||||||
|
|
|
@ -15,9 +15,9 @@ namespace
|
||||||
{
|
{
|
||||||
inline int thisThrows()
|
inline int thisThrows()
|
||||||
{
|
{
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw std::domain_error( "expected exception" );
|
throw std::domain_error( "expected exception" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int thisDoesntThrow()
|
int thisDoesntThrow()
|
||||||
|
@ -42,23 +42,23 @@ TEST_CASE( "Expected exceptions that don't throw or unexpected exceptions fail t
|
||||||
|
|
||||||
TEST_CASE( "When unchecked exceptions are thrown directly they are always failures", "[.][failing][!throws]" )
|
TEST_CASE( "When unchecked exceptions are thrown directly they are always failures", "[.][failing][!throws]" )
|
||||||
{
|
{
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw std::domain_error( "unexpected exception" );
|
throw std::domain_error( "unexpected exception" );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "An unchecked exception reports the line of the last assertion", "[.][failing][!throws]" )
|
TEST_CASE( "An unchecked exception reports the line of the last assertion", "[.][failing][!throws]" )
|
||||||
{
|
{
|
||||||
CHECK( 1 == 1 );
|
CHECK( 1 == 1 );
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw std::domain_error( "unexpected exception" );
|
throw std::domain_error( "unexpected exception" );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "When unchecked exceptions are thrown from sections they are always failures", "[.][failing][!throws]" )
|
TEST_CASE( "When unchecked exceptions are thrown from sections they are always failures", "[.][failing][!throws]" )
|
||||||
{
|
{
|
||||||
SECTION( "section name", "" )
|
SECTION( "section name", "" )
|
||||||
{
|
{
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw std::domain_error( "unexpected exception" );
|
throw std::domain_error( "unexpected exception" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ CATCH_TRANSLATE_EXCEPTION( double& ex )
|
||||||
|
|
||||||
TEST_CASE("Non-std exceptions can be translated", "[.][failing][!throws]" )
|
TEST_CASE("Non-std exceptions can be translated", "[.][failing][!throws]" )
|
||||||
{
|
{
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw CustomException( "custom exception" );
|
throw CustomException( "custom exception" );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Custom std-exceptions can be custom translated", "[.][failing][!throws]" )
|
TEST_CASE("Custom std-exceptions can be custom translated", "[.][failing][!throws]" )
|
||||||
|
@ -156,8 +156,8 @@ TEST_CASE("Custom std-exceptions can be custom translated", "[.][failing][!throw
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void throwCustom() {
|
inline void throwCustom() {
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw CustomException( "custom exception - not std" );
|
throw CustomException( "custom exception - not std" );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing][!throws]" )
|
TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing][!throws]" )
|
||||||
|
@ -173,8 +173,8 @@ TEST_CASE( "Custom exceptions can be translated when testing for throwing as som
|
||||||
|
|
||||||
TEST_CASE( "Unexpected exceptions can be translated", "[.][failing][!throws]" )
|
TEST_CASE( "Unexpected exceptions can be translated", "[.][failing][!throws]" )
|
||||||
{
|
{
|
||||||
if( Catch::alwaysTrue() )
|
if( Catch::alwaysTrue() )
|
||||||
throw double( 3.14 );
|
throw double( 3.14 );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int thisFunctionNotImplemented( int ) {
|
inline int thisFunctionNotImplemented( int ) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ def fixFile( path ):
|
||||||
changed = 0
|
changed = 0
|
||||||
for line in f:
|
for line in f:
|
||||||
trimmed = line.rstrip() + "\n"
|
trimmed = line.rstrip() + "\n"
|
||||||
|
trimmed = trimmed.replace('\t', ' ')
|
||||||
if trimmed != line:
|
if trimmed != line:
|
||||||
changed = changed +1
|
changed = changed +1
|
||||||
lines.append( trimmed )
|
lines.append( trimmed )
|
Loading…
Reference in New Issue