From 203fd681872b15fd7de80247f3276d1c1b0c5fdf Mon Sep 17 00:00:00 2001 From: Patrick Martin Date: Thu, 19 Jul 2012 23:03:51 +0100 Subject: [PATCH] initial draft of changes to support Borland c++ Builder 5 / free compiler 5.5 --- .gitignore | 7 ++++++- include/internal/catch_commandline.hpp | 2 +- include/internal/catch_console_colour_impl.hpp | 2 +- include/internal/catch_interfaces_reporter.h | 2 +- include/internal/catch_resultinfo.hpp | 2 +- include/internal/catch_runner_impl.hpp | 2 +- include/reporters/catch_reporter_basic.hpp | 2 +- single_include/catch.hpp | 17 +++++++---------- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index ccd16f6c..4feb791b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,9 @@ Breakpoints.xcbkptlist projects/VS2010/TestCatch/_UpgradeReport_Files/ projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters projects/VisualStudio/TestCatch/UpgradeLog.XML -UpgradeLog.XML \ No newline at end of file +UpgradeLog.XML +/projects\CPPBuilder5/*.~cpp +/single_include/*.~HPP +/projects\CPPBuilder5/*.~cpp +/projects\CPPBuilder5/*.~cpp +/projects\CPPBuilder5/*.~cpp diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index 49928f4c..6c35d306 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -61,7 +61,7 @@ namespace Catch { class CommandParser { public: - CommandParser( int argc, char const * const * argv ) : m_argc( static_cast( argc ) ), m_argv( argv ) {} + CommandParser( int argc, char* const argv[] ) : m_argc( static_cast( argc ) ), m_argv( argv ) {} Command find( const std::string& arg1, const std::string& arg2, const std::string& arg3 ) const { return find( arg1 ) + find( arg2 ) + find( arg3 ); diff --git a/include/internal/catch_console_colour_impl.hpp b/include/internal/catch_console_colour_impl.hpp index 1830e182..591e9720 100644 --- a/include/internal/catch_console_colour_impl.hpp +++ b/include/internal/catch_console_colour_impl.hpp @@ -54,7 +54,7 @@ namespace Catch { } void set( TextColour::Colours colour ) { - WORD consoleColour = mapConsoleColour( colour ); + WORD consoleColour = Catch::mapConsoleColour( colour ); if( consoleColour > 0 ) SetConsoleTextAttribute( hStdout, consoleColour ); } diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index 47cf1830..4df75646 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -62,7 +62,7 @@ namespace Catch std::string::size_type start = str.find_first_not_of( "\n\r\t " ); std::string::size_type end = str.find_last_not_of( "\n\r\t " ); - return start != std::string::npos ? str.substr( start, 1+end-start ) : ""; + return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); } } diff --git a/include/internal/catch_resultinfo.hpp b/include/internal/catch_resultinfo.hpp index da291414..8fd8c10a 100644 --- a/include/internal/catch_resultinfo.hpp +++ b/include/internal/catch_resultinfo.hpp @@ -73,7 +73,7 @@ namespace Catch { } std::string getExpandedExpression() const { - return hasExpression() ? getExpandedExpressionInternal() : ""; + return hasExpression() ? getExpandedExpressionInternal() : std::string(); } std::string getMessage() const { diff --git a/include/internal/catch_runner_impl.hpp b/include/internal/catch_runner_impl.hpp index bcca0392..dd0e6d3b 100644 --- a/include/internal/catch_runner_impl.hpp +++ b/include/internal/catch_runner_impl.hpp @@ -227,7 +227,7 @@ namespace Catch { virtual std::string getCurrentTestName() const { return m_runningTest ? m_runningTest->getTestCaseInfo().getName() - : ""; + : std::string(); } virtual const ResultInfo* getLastResult() const { diff --git a/include/reporters/catch_reporter_basic.hpp b/include/reporters/catch_reporter_basic.hpp index f5fc6ee1..1e1e1e66 100644 --- a/include/reporters/catch_reporter_basic.hpp +++ b/include/reporters/catch_reporter_basic.hpp @@ -71,7 +71,7 @@ namespace Catch { if( counts.passed ) m_config.stream() << counts.failed << " of " << counts.total() << " " << label << "s failed"; else - m_config.stream() << ( counts.failed > 1 ? allPrefix : "" ) << pluralise( counts.failed, label ) << " failed"; + m_config.stream() << ( counts.failed > 1 ? allPrefix : std::string() ) << pluralise( counts.failed, label ) << " failed"; } void ReportCounts( const Totals& totals, const std::string& allPrefix = "All " ) { diff --git a/single_include/catch.hpp b/single_include/catch.hpp index e4267200..aa5bbbd1 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1,5 +1,5 @@ /* - * Generated: 2012-07-05 18:47:13.729198 + * Generated: 2012-07-19 00:07:37.689000 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -318,7 +318,7 @@ namespace Catch std::string::size_type start = str.find_first_not_of( "\n\r\t " ); std::string::size_type end = str.find_last_not_of( "\n\r\t " ); - return start != std::string::npos ? str.substr( start, 1+end-start ) : ""; + return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); } } @@ -759,7 +759,7 @@ namespace Catch { } std::string getExpandedExpression() const { - return hasExpression() ? getExpandedExpressionInternal() : ""; + return hasExpression() ? getExpandedExpressionInternal() : std::string(); } std::string getMessage() const { @@ -2212,9 +2212,6 @@ namespace Catch { inline std::string toString( NSString* const& nsstring ) { return std::string( "@\"" ) + [nsstring UTF8String] + "\""; } - inline std::string toString( NSObject* const& nsObject ) { - return toString( [nsObject description] ); - } namespace Matchers { namespace Impl { @@ -2986,7 +2983,7 @@ namespace Catch { virtual std::string getCurrentTestName() const { return m_runningTest ? m_runningTest->getTestCaseInfo().getName() - : ""; + : std::string(); } virtual const ResultInfo* getLastResult() const { @@ -3210,7 +3207,7 @@ namespace Catch { } void set( TextColour::Colours colour ) { - WORD consoleColour = mapConsoleColour( colour ); + WORD consoleColour = Catch::mapConsoleColour( colour ); if( consoleColour > 0 ) SetConsoleTextAttribute( hStdout, consoleColour ); } @@ -3551,7 +3548,7 @@ namespace Catch { class CommandParser { public: - CommandParser( int argc, char const * const * argv ) : m_argc( static_cast( argc ) ), m_argv( argv ) {} + CommandParser( int argc, char* const argv[] ) : m_argc( static_cast( argc ) ), m_argv( argv ) {} Command find( const std::string& arg1, const std::string& arg2, const std::string& arg3 ) const { return find( arg1 ) + find( arg2 ) + find( arg3 ); @@ -3799,7 +3796,7 @@ namespace Catch { if( counts.passed ) m_config.stream() << counts.failed << " of " << counts.total() << " " << label << "s failed"; else - m_config.stream() << ( counts.failed > 1 ? allPrefix : "" ) << pluralise( counts.failed, label ) << " failed"; + m_config.stream() << ( counts.failed > 1 ? allPrefix : std::string() ) << pluralise( counts.failed, label ) << " failed"; } void ReportCounts( const Totals& totals, const std::string& allPrefix = "All " ) {