mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-30 19:57:10 +01:00 
			
		
		
		
	Use char literal instead of string literal with 1 char
In reality, this is a relatively small performance improvement, especially with the previous improvements removing lots of superfluous string handling, but still was measurable.
This commit is contained in:
		| @@ -56,7 +56,7 @@ namespace Catch { | ||||
|  | ||||
|     std::string AssertionResult::getExpression() const { | ||||
|         if( isFalseTest( m_info.resultDisposition ) ) | ||||
|             return "!" + m_info.capturedExpression; | ||||
|             return '!' + m_info.capturedExpression; | ||||
|         else | ||||
|             return m_info.capturedExpression; | ||||
|     } | ||||
|   | ||||
| @@ -30,7 +30,7 @@ namespace Catch { | ||||
|         if( _warning == "NoAssertions" ) | ||||
|             config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions ); | ||||
|         else | ||||
|             throw std::runtime_error( "Unrecognised warning: '" + _warning + "'" ); | ||||
|             throw std::runtime_error( "Unrecognised warning: '" + _warning + '\'' ); | ||||
|     } | ||||
|     inline void setOrder( ConfigData& config, std::string const& order ) { | ||||
|         if( startsWith( "declared", order ) ) | ||||
| @@ -40,7 +40,7 @@ namespace Catch { | ||||
|         else if( startsWith( "random", order ) ) | ||||
|             config.runOrder = RunTests::InRandomOrder; | ||||
|         else | ||||
|             throw std::runtime_error( "Unrecognised ordering: '" + order + "'" ); | ||||
|             throw std::runtime_error( "Unrecognised ordering: '" + order + '\'' ); | ||||
|     } | ||||
|     inline void setRngSeed( ConfigData& config, std::string const& seed ) { | ||||
|         if( seed == "time" ) { | ||||
| @@ -88,7 +88,7 @@ namespace Catch { | ||||
|             line = trim(line); | ||||
|             if( !line.empty() && !startsWith( line, '#' ) ) { | ||||
|                 if( !startsWith( line, '"' ) ) | ||||
|                     line = "\"" + line + "\""; | ||||
|                     line = '"' + line + '"'; | ||||
|                 addTestOrTags( config, line + ',' ); | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -71,9 +71,9 @@ namespace Catch { | ||||
|     {} | ||||
|  | ||||
|     std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { | ||||
|         os << pluraliser.m_count << " " << pluraliser.m_label; | ||||
|         os << pluraliser.m_count << ' ' << pluraliser.m_label; | ||||
|         if( pluraliser.m_count != 1 ) | ||||
|             os << "s"; | ||||
|             os << 's'; | ||||
|         return os; | ||||
|     } | ||||
|  | ||||
| @@ -111,7 +111,7 @@ namespace Catch { | ||||
|  | ||||
|     void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo ) { | ||||
|         std::ostringstream oss; | ||||
|         oss << locationInfo << ": Internal Catch error: '" << message << "'"; | ||||
|         oss << locationInfo << ": Internal Catch error: '" << message << '\''; | ||||
|         if( alwaysTrue() ) | ||||
|             throw std::logic_error( oss.str() ); | ||||
|     } | ||||
|   | ||||
| @@ -69,7 +69,7 @@ namespace Catch { | ||||
|             matchedTests++; | ||||
|             TestCaseInfo const& testCaseInfo = it->getTestCaseInfo(); | ||||
|             if( startsWith( testCaseInfo.name, '#' ) ) | ||||
|                Catch::cout() << "\"" << testCaseInfo.name << "\"" << std::endl; | ||||
|                Catch::cout() << '"' << testCaseInfo.name << '"' << std::endl; | ||||
|             else | ||||
|                Catch::cout() << testCaseInfo.name << std::endl; | ||||
|         } | ||||
| @@ -132,9 +132,9 @@ namespace Catch { | ||||
|                                                     .setInitialIndent( 0 ) | ||||
|                                                     .setIndent( oss.str().size() ) | ||||
|                                                     .setWidth( CATCH_CONFIG_CONSOLE_WIDTH-10 ) ); | ||||
|             Catch::cout() << oss.str() << wrapper << "\n"; | ||||
|             Catch::cout() << oss.str() << wrapper << '\n'; | ||||
|         } | ||||
|         Catch::cout() << pluralise( tagCounts.size(), "tag" ) << "\n" << std::endl; | ||||
|         Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl; | ||||
|         return tagCounts.size(); | ||||
|     } | ||||
|  | ||||
| @@ -153,9 +153,9 @@ namespace Catch { | ||||
|                                                         .setWidth( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) ); | ||||
|             Catch::cout() << "  " | ||||
|                     << it->first | ||||
|                     << ":" | ||||
|                     << ':' | ||||
|                     << std::string( maxNameLen - it->first.size() + 2, ' ' ) | ||||
|                     << wrapper << "\n"; | ||||
|                     << wrapper << '\n'; | ||||
|         } | ||||
|         Catch::cout() << std::endl; | ||||
|         return factories.size(); | ||||
|   | ||||
| @@ -202,7 +202,7 @@ namespace Matchers { | ||||
|                 return m_data.m_str == m_data.adjustString( expr );; | ||||
|             } | ||||
|             virtual std::string toString() const { | ||||
|                 return "equals: \"" + m_data.m_str + "\"" + m_data.toStringSuffix(); | ||||
|                 return "equals: \"" + m_data.m_str + '"' + m_data.toStringSuffix(); | ||||
|             } | ||||
|  | ||||
|             CasedString m_data; | ||||
| @@ -219,7 +219,7 @@ namespace Matchers { | ||||
|                 return m_data.adjustString( expr ).find( m_data.m_str ) != std::string::npos; | ||||
|             } | ||||
|             virtual std::string toString() const { | ||||
|                 return "contains: \"" + m_data.m_str  + "\"" + m_data.toStringSuffix(); | ||||
|                 return "contains: \"" + m_data.m_str  + '"' + m_data.toStringSuffix(); | ||||
|             } | ||||
|  | ||||
|             CasedString m_data; | ||||
| @@ -237,7 +237,7 @@ namespace Matchers { | ||||
|                 return startsWith( m_data.adjustString( expr ), m_data.m_str ); | ||||
|             } | ||||
|             virtual std::string toString() const { | ||||
|                 return "starts with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix(); | ||||
|                 return "starts with: \"" + m_data.m_str + '"' + m_data.toStringSuffix(); | ||||
|             } | ||||
|  | ||||
|             CasedString m_data; | ||||
| @@ -254,7 +254,7 @@ namespace Matchers { | ||||
|                 return endsWith( m_data.adjustString( expr ), m_data.m_str ); | ||||
|             } | ||||
|             virtual std::string toString() const { | ||||
|                 return "ends with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix(); | ||||
|                 return "ends with: \"" + m_data.m_str + '"' + m_data.toStringSuffix(); | ||||
|             } | ||||
|  | ||||
|             CasedString m_data; | ||||
|   | ||||
| @@ -61,7 +61,7 @@ namespace Catch { | ||||
|         m_ofs.open( filename.c_str() ); | ||||
|         if( m_ofs.fail() ) { | ||||
|             std::ostringstream oss; | ||||
|             oss << "Unable to open file: '" << filename << "'"; | ||||
|             oss << "Unable to open file: '" << filename << '\''; | ||||
|             throw std::domain_error( oss.str() ); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -102,7 +102,7 @@ namespace Catch { | ||||
|  | ||||
|         std::ostringstream oss; | ||||
|         for( std::set<std::string>::const_iterator it = tags.begin(), itEnd = tags.end(); it != itEnd; ++it ) { | ||||
|             oss << "[" << *it << "]"; | ||||
|             oss << '[' << *it << ']'; | ||||
|             std::string lcaseTag = toLower( *it ); | ||||
|             testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) ); | ||||
|             testCaseInfo.lcaseTags.insert( lcaseTag ); | ||||
|   | ||||
| @@ -69,7 +69,7 @@ std::string toString( std::string const& value ) { | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     return "\"" + s + "\""; | ||||
|     return '"' + s + '"'; | ||||
| } | ||||
| std::string toString( std::wstring const& value ) { | ||||
|  | ||||
| @@ -138,7 +138,7 @@ std::string toString( const double value ) { | ||||
|     return fpToString( value, 10 ); | ||||
| } | ||||
| std::string toString( const float value ) { | ||||
|     return fpToString( value, 5 ) + "f"; | ||||
|     return fpToString( value, 5 ) + 'f'; | ||||
| } | ||||
|  | ||||
| std::string toString( bool value ) { | ||||
|   | ||||
| @@ -26,13 +26,13 @@ namespace Catch { | ||||
|     {} | ||||
|  | ||||
|     std::ostream& operator << ( std::ostream& os, Version const& version ) { | ||||
|         os  << version.majorVersion << "." | ||||
|             << version.minorVersion << "." | ||||
|         os  << version.majorVersion << '.' | ||||
|             << version.minorVersion << '.' | ||||
|             << version.patchNumber; | ||||
|  | ||||
|         if( !version.branchName.empty() ) { | ||||
|             os  << "-" << version.branchName | ||||
|                 << "." << version.buildNumber; | ||||
|             os  << '-' << version.branchName | ||||
|                 << '.' << version.buildNumber; | ||||
|         } | ||||
|         return os; | ||||
|     } | ||||
|   | ||||
| @@ -136,7 +136,7 @@ namespace Catch { | ||||
|         XmlWriter& startElement( std::string const& name ) { | ||||
|             ensureTagClosed(); | ||||
|             newlineIfNecessary(); | ||||
|             stream() << m_indent << "<" << name; | ||||
|             stream() << m_indent << '<' << name; | ||||
|             m_tags.push_back( name ); | ||||
|             m_indent += "  "; | ||||
|             m_tagIsOpen = true; | ||||
| @@ -165,12 +165,12 @@ namespace Catch { | ||||
|  | ||||
|         XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ) { | ||||
|             if( !name.empty() && !attribute.empty() ) | ||||
|                 stream() << " " << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << "\""; | ||||
|                 stream() << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"'; | ||||
|             return *this; | ||||
|         } | ||||
|  | ||||
|         XmlWriter& writeAttribute( std::string const& name, bool attribute ) { | ||||
|             stream() << " " << name << "=\"" << ( attribute ? "true" : "false" ) << "\""; | ||||
|             stream() << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"'; | ||||
|             return *this; | ||||
|         } | ||||
|  | ||||
| @@ -227,7 +227,7 @@ namespace Catch { | ||||
|  | ||||
|         void newlineIfNecessary() { | ||||
|             if( m_needsNewline ) { | ||||
|                 stream() << "\n"; | ||||
|                 stream() << '\n'; | ||||
|                 m_needsNewline = false; | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -34,7 +34,7 @@ namespace Catch { | ||||
|         } | ||||
|  | ||||
|         virtual void noMatchingTestCases( std::string const& spec ) { | ||||
|             stream << "No test cases matched '" << spec << "'" << std::endl; | ||||
|             stream << "No test cases matched '" << spec << '\'' << std::endl; | ||||
|         } | ||||
|  | ||||
|         virtual void assertionStarting( AssertionInfo const& ) { | ||||
| @@ -61,7 +61,7 @@ namespace Catch { | ||||
|  | ||||
|         virtual void testRunEnded( TestRunStats const& _testRunStats ) { | ||||
|             printTotals( _testRunStats.totals ); | ||||
|             stream << "\n" << std::endl; | ||||
|             stream << '\n' << std::endl; | ||||
|             StreamingReporterBase::testRunEnded( _testRunStats ); | ||||
|         } | ||||
|  | ||||
| @@ -161,26 +161,26 @@ namespace Catch { | ||||
|  | ||||
|             void printSourceInfo() const { | ||||
|                 Colour colourGuard( Colour::FileName ); | ||||
|                 stream << result.getSourceInfo() << ":"; | ||||
|                 stream << result.getSourceInfo() << ':'; | ||||
|             } | ||||
|  | ||||
|             void printResultType( Colour::Code colour, std::string passOrFail ) const { | ||||
|                 if( !passOrFail.empty() ) { | ||||
|                     { | ||||
|                         Colour colourGuard( colour ); | ||||
|                         stream << " " << passOrFail; | ||||
|                         stream << ' ' << passOrFail; | ||||
|                     } | ||||
|                     stream << ":"; | ||||
|                     stream << ':'; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             void printIssue( std::string issue ) const { | ||||
|                 stream << " " << issue; | ||||
|                 stream << ' ' << issue; | ||||
|             } | ||||
|  | ||||
|             void printExpressionWas() { | ||||
|                 if( result.hasExpression() ) { | ||||
|                     stream << ";"; | ||||
|                     stream << ';'; | ||||
|                     { | ||||
|                         Colour colour( dimColour() ); | ||||
|                         stream << " expression was:"; | ||||
| @@ -191,7 +191,7 @@ namespace Catch { | ||||
|  | ||||
|             void printOriginalExpression() const { | ||||
|                 if( result.hasExpression() ) { | ||||
|                     stream << " " << result.getExpression(); | ||||
|                     stream << ' ' << result.getExpression(); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
| @@ -207,7 +207,7 @@ namespace Catch { | ||||
|  | ||||
|             void printMessage() { | ||||
|                 if ( itMessage != messages.end() ) { | ||||
|                     stream << " '" << itMessage->message << "'"; | ||||
|                     stream << " '" << itMessage->message << '\''; | ||||
|                     ++itMessage; | ||||
|                 } | ||||
|             } | ||||
| @@ -222,13 +222,13 @@ namespace Catch { | ||||
|  | ||||
|                 { | ||||
|                     Colour colourGuard( colour ); | ||||
|                     stream << " with " << pluralise( N, "message" ) << ":"; | ||||
|                     stream << " with " << pluralise( N, "message" ) << ':'; | ||||
|                 } | ||||
|  | ||||
|                 for(; itMessage != itEnd; ) { | ||||
|                     // If this assertion is a warning ignore any INFO messages | ||||
|                     if( printInfoMessages || itMessage->type != ResultWas::Info ) { | ||||
|                         stream << " '" << itMessage->message << "'"; | ||||
|                         stream << " '" << itMessage->message << '\''; | ||||
|                         if ( ++itMessage != itEnd ) { | ||||
|                             Colour colourGuard( dimColour() ); | ||||
|                             stream << " and"; | ||||
| @@ -254,7 +254,7 @@ namespace Catch { | ||||
|         // - green: Passed [both/all] N tests cases with M assertions. | ||||
|  | ||||
|         std::string bothOrAll( std::size_t count ) const { | ||||
|             return count == 1 ? "" : count == 2 ? "both " : "all " ; | ||||
|             return count == 1 ? std::string() : count == 2 ? "both " : "all " ; | ||||
|         } | ||||
|  | ||||
|         void printTotals( const Totals& totals ) const { | ||||
| @@ -265,12 +265,12 @@ namespace Catch { | ||||
|                 Colour colour( Colour::ResultError ); | ||||
|                 const std::string qualify_assertions_failed = | ||||
|                     totals.assertions.failed == totals.assertions.total() ? | ||||
|                         bothOrAll( totals.assertions.failed ) : ""; | ||||
|                         bothOrAll( totals.assertions.failed ) : std::string(); | ||||
|                 stream << | ||||
|                     "Failed " << bothOrAll( totals.testCases.failed ) | ||||
|                               << pluralise( totals.testCases.failed, "test case"  ) << ", " | ||||
|                     "failed " << qualify_assertions_failed << | ||||
|                                  pluralise( totals.assertions.failed, "assertion" ) << "."; | ||||
|                                  pluralise( totals.assertions.failed, "assertion" ) << '.'; | ||||
|             } | ||||
|             else if( totals.assertions.total() == 0 ) { | ||||
|                 stream << | ||||
| @@ -282,14 +282,14 @@ namespace Catch { | ||||
|                 Colour colour( Colour::ResultError ); | ||||
|                 stream << | ||||
|                     "Failed " << pluralise( totals.testCases.failed, "test case"  ) << ", " | ||||
|                     "failed " << pluralise( totals.assertions.failed, "assertion" ) << "."; | ||||
|                     "failed " << pluralise( totals.assertions.failed, "assertion" ) << '.'; | ||||
|             } | ||||
|             else { | ||||
|                 Colour colour( Colour::ResultSuccess ); | ||||
|                 stream << | ||||
|                     "Passed " << bothOrAll( totals.testCases.passed ) | ||||
|                               << pluralise( totals.testCases.passed, "test case"  ) << | ||||
|                     " with "  << pluralise( totals.assertions.passed, "assertion" ) << "."; | ||||
|                     " with "  << pluralise( totals.assertions.passed, "assertion" ) << '.'; | ||||
|             } | ||||
|         } | ||||
|     }; | ||||
|   | ||||
| @@ -27,7 +27,7 @@ namespace Catch { | ||||
|         } | ||||
|  | ||||
|         virtual void noMatchingTestCases( std::string const& spec ) CATCH_OVERRIDE { | ||||
|             stream << "No test cases matched '" << spec << "'" << std::endl; | ||||
|             stream << "No test cases matched '" << spec << '\'' << std::endl; | ||||
|         } | ||||
|  | ||||
|         virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { | ||||
| @@ -69,12 +69,12 @@ namespace Catch { | ||||
|             } | ||||
|             if( m_headerPrinted ) { | ||||
|                 if( m_config->showDurations() == ShowDurations::Always ) | ||||
|                     stream << "Completed in " << _sectionStats.durationInSeconds << "s" << std::endl; | ||||
|                     stream << "Completed in " << _sectionStats.durationInSeconds << 's' << std::endl; | ||||
|                 m_headerPrinted = false; | ||||
|             } | ||||
|             else { | ||||
|                 if( m_config->showDurations() == ShowDurations::Always ) | ||||
|                     stream << _sectionStats.sectionInfo.name << " completed in " << _sectionStats.durationInSeconds << "s" << std::endl; | ||||
|                     stream << _sectionStats.sectionInfo.name << " completed in " << _sectionStats.durationInSeconds << 's' << std::endl; | ||||
|             } | ||||
|             StreamingReporterBase::sectionEnded( _sectionStats ); | ||||
|         } | ||||
| @@ -88,7 +88,7 @@ namespace Catch { | ||||
|                 printSummaryDivider(); | ||||
|                 stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; | ||||
|                 printTotals( _testGroupStats.totals ); | ||||
|                 stream << "\n" << std::endl; | ||||
|                 stream << '\n' << std::endl; | ||||
|             } | ||||
|             StreamingReporterBase::testGroupEnded( _testGroupStats ); | ||||
|         } | ||||
| @@ -180,13 +180,13 @@ namespace Catch { | ||||
|                 printSourceInfo(); | ||||
|                 if( stats.totals.assertions.total() > 0 ) { | ||||
|                     if( result.isOk() ) | ||||
|                         stream << "\n"; | ||||
|                         stream << '\n'; | ||||
|                     printResultType(); | ||||
|                     printOriginalExpression(); | ||||
|                     printReconstructedExpression(); | ||||
|                 } | ||||
|                 else { | ||||
|                     stream << "\n"; | ||||
|                     stream << '\n'; | ||||
|                 } | ||||
|                 printMessage(); | ||||
|             } | ||||
| @@ -203,25 +203,25 @@ namespace Catch { | ||||
|                     Colour colourGuard( Colour::OriginalExpression ); | ||||
|                     stream  << "  "; | ||||
|                     stream << result.getExpressionInMacro(); | ||||
|                     stream << "\n"; | ||||
|                     stream << '\n'; | ||||
|                 } | ||||
|             } | ||||
|             void printReconstructedExpression() const { | ||||
|                 if( result.hasExpandedExpression() ) { | ||||
|                     stream << "with expansion:\n"; | ||||
|                     Colour colourGuard( Colour::ReconstructedExpression ); | ||||
|                     stream << Text( result.getExpandedExpression(), TextAttributes().setIndent(2) ) << "\n"; | ||||
|                     stream << Text( result.getExpandedExpression(), TextAttributes().setIndent(2) ) << '\n'; | ||||
|                 } | ||||
|             } | ||||
|             void printMessage() const { | ||||
|                 if( !messageLabel.empty() ) | ||||
|                     stream << messageLabel << ":" << "\n"; | ||||
|                     stream << messageLabel << ':' << '\n'; | ||||
|                 for( std::vector<MessageInfo>::const_iterator it = messages.begin(), itEnd = messages.end(); | ||||
|                         it != itEnd; | ||||
|                         ++it ) { | ||||
|                     // If this assertion is a warning ignore any INFO messages | ||||
|                     if( printInfoMessages || it->type != ResultWas::Info ) | ||||
|                         stream << Text( it->message, TextAttributes().setIndent(2) ) << "\n"; | ||||
|                         stream << Text( it->message, TextAttributes().setIndent(2) ) << '\n'; | ||||
|                 } | ||||
|             } | ||||
|             void printSourceInfo() const { | ||||
| @@ -253,7 +253,7 @@ namespace Catch { | ||||
|             } | ||||
|         } | ||||
|         void lazyPrintRunInfo() { | ||||
|             stream  << "\n" << getLineOfChars<'~'>() << "\n"; | ||||
|             stream  << '\n' << getLineOfChars<'~'>() << '\n'; | ||||
|             Colour colour( Colour::SecondaryText ); | ||||
|             stream  << currentTestRunInfo->name | ||||
|                     << " is a Catch v"  << libraryVersion << " host application.\n" | ||||
| @@ -287,19 +287,19 @@ namespace Catch { | ||||
|             SourceLineInfo lineInfo = m_sectionStack.front().lineInfo; | ||||
|  | ||||
|             if( !lineInfo.empty() ){ | ||||
|                 stream << getLineOfChars<'-'>() << "\n"; | ||||
|                 stream << getLineOfChars<'-'>() << '\n'; | ||||
|                 Colour colourGuard( Colour::FileName ); | ||||
|                 stream << lineInfo << "\n"; | ||||
|                 stream << lineInfo << '\n'; | ||||
|             } | ||||
|             stream << getLineOfChars<'.'>() << "\n" << std::endl; | ||||
|             stream << getLineOfChars<'.'>() << '\n' << std::endl; | ||||
|         } | ||||
|  | ||||
|         void printClosedHeader( std::string const& _name ) { | ||||
|             printOpenHeader( _name ); | ||||
|             stream << getLineOfChars<'.'>() << "\n"; | ||||
|             stream << getLineOfChars<'.'>() << '\n'; | ||||
|         } | ||||
|         void printOpenHeader( std::string const& _name ) { | ||||
|             stream  << getLineOfChars<'-'>() << "\n"; | ||||
|             stream  << getLineOfChars<'-'>() << '\n'; | ||||
|             { | ||||
|                 Colour colourGuard( Colour::Headers ); | ||||
|                 printHeaderString( _name ); | ||||
| @@ -316,7 +316,7 @@ namespace Catch { | ||||
|                 i = 0; | ||||
|             stream << Text( _string, TextAttributes() | ||||
|                                         .setIndent( indent+i) | ||||
|                                         .setInitialIndent( indent ) ) << "\n"; | ||||
|                                         .setInitialIndent( indent ) ) << '\n'; | ||||
|         } | ||||
|  | ||||
|         struct SummaryColumn { | ||||
| @@ -331,9 +331,9 @@ namespace Catch { | ||||
|                 std::string row = oss.str(); | ||||
|                 for( std::vector<std::string>::iterator it = rows.begin(); it != rows.end(); ++it ) { | ||||
|                     while( it->size() < row.size() ) | ||||
|                         *it = " " + *it; | ||||
|                         *it = ' ' + *it; | ||||
|                     while( it->size() > row.size() ) | ||||
|                         row = " " + row; | ||||
|                         row = ' ' + row; | ||||
|                 } | ||||
|                 rows.push_back( row ); | ||||
|                 return *this; | ||||
| @@ -353,8 +353,8 @@ namespace Catch { | ||||
|                 stream << Colour( Colour::ResultSuccess ) << "All tests passed"; | ||||
|                 stream << " (" | ||||
|                         << pluralise( totals.assertions.passed, "assertion" ) << " in " | ||||
|                         << pluralise( totals.testCases.passed, "test case" ) << ")" | ||||
|                         << "\n"; | ||||
|                         << pluralise( totals.testCases.passed, "test case" ) << ')' | ||||
|                         << '\n'; | ||||
|             } | ||||
|             else { | ||||
|  | ||||
| @@ -389,10 +389,10 @@ namespace Catch { | ||||
|                 else if( value != "0" ) { | ||||
|                     stream  << Colour( Colour::LightGrey ) << " | "; | ||||
|                     stream  << Colour( it->colour ) | ||||
|                             << value << " " << it->label; | ||||
|                             << value << ' ' << it->label; | ||||
|                 } | ||||
|             } | ||||
|             stream << "\n"; | ||||
|             stream << '\n'; | ||||
|         } | ||||
|  | ||||
|         static std::size_t makeRatio( std::size_t number, std::size_t total ) { | ||||
| @@ -428,10 +428,10 @@ namespace Catch { | ||||
|             else { | ||||
|                 stream << Colour( Colour::Warning ) << std::string( CATCH_CONFIG_CONSOLE_WIDTH-1, '=' ); | ||||
|             } | ||||
|             stream << "\n"; | ||||
|             stream << '\n'; | ||||
|         } | ||||
|         void printSummaryDivider() { | ||||
|             stream << getLineOfChars<'-'>() << "\n"; | ||||
|             stream << getLineOfChars<'-'>() << '\n'; | ||||
|         } | ||||
|  | ||||
|     private: | ||||
|   | ||||
| @@ -146,7 +146,7 @@ namespace Catch { | ||||
|                             SectionNode const& sectionNode ) { | ||||
|             std::string name = trim( sectionNode.stats.sectionInfo.name ); | ||||
|             if( !rootName.empty() ) | ||||
|                 name = rootName + "/" + name; | ||||
|                 name = rootName + '/' + name; | ||||
|  | ||||
|             if( !sectionNode.assertions.empty() || | ||||
|                 !sectionNode.stdOut.empty() || | ||||
| @@ -224,14 +224,14 @@ namespace Catch { | ||||
|  | ||||
|                 std::ostringstream oss; | ||||
|                 if( !result.getMessage().empty() ) | ||||
|                     oss << result.getMessage() << "\n"; | ||||
|                     oss << result.getMessage() << '\n'; | ||||
|                 for( std::vector<MessageInfo>::const_iterator | ||||
|                         it = stats.infoMessages.begin(), | ||||
|                         itEnd = stats.infoMessages.end(); | ||||
|                             it != itEnd; | ||||
|                             ++it ) | ||||
|                     if( it->type == ResultWas::Info ) | ||||
|                         oss << it->message << "\n"; | ||||
|                         oss << it->message << '\n'; | ||||
|  | ||||
|                 oss << "at " << result.getSourceInfo(); | ||||
|                 xml.writeText( oss.str(), false ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský