mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Replace some static strings with static char*s for leak detection friendliness (h/t #272)
This commit is contained in:
		| @@ -256,7 +256,7 @@ namespace Catch { | ||||
|             m_atLeastOneTestCasePrinted = true; | ||||
|         } | ||||
|         void lazyPrintRunInfo() { | ||||
|             stream  << "\n" << getTildes() << "\n"; | ||||
|             stream  << "\n" << getLineOfChars<'~'>() << "\n"; | ||||
|             Colour colour( Colour::SecondaryText ); | ||||
|             stream  << currentTestRunInfo->name | ||||
|                     << " is a Catch v"  << libraryVersion.majorVersion << "." | ||||
| @@ -292,19 +292,19 @@ namespace Catch { | ||||
|             SourceLineInfo lineInfo = m_sectionStack.front().lineInfo; | ||||
|  | ||||
|             if( !lineInfo.empty() ){ | ||||
|                 stream << getDashes() << "\n"; | ||||
|                 stream << getLineOfChars<'-'>() << "\n"; | ||||
|                 Colour colourGuard( Colour::FileName ); | ||||
|                 stream << lineInfo << "\n"; | ||||
|             } | ||||
|             stream << getDots() << "\n" << std::endl; | ||||
|             stream << getLineOfChars<'.'>() << "\n" << std::endl; | ||||
|         } | ||||
|  | ||||
|         void printClosedHeader( std::string const& _name ) { | ||||
|             printOpenHeader( _name ); | ||||
|             stream << getDots() << "\n"; | ||||
|             stream << getLineOfChars<'.'>() << "\n"; | ||||
|         } | ||||
|         void printOpenHeader( std::string const& _name ) { | ||||
|             stream  << getDashes() << "\n"; | ||||
|             stream  << getLineOfChars<'-'>() << "\n"; | ||||
|             { | ||||
|                 Colour colourGuard( Colour::Headers ); | ||||
|                 printHeaderString( _name ); | ||||
| @@ -377,26 +377,19 @@ namespace Catch { | ||||
|         } | ||||
|  | ||||
|         void printTotalsDivider() { | ||||
|             stream << getDoubleDashes() << "\n"; | ||||
|             stream << getLineOfChars<'='>() << "\n"; | ||||
|         } | ||||
|         void printSummaryDivider() { | ||||
|             stream << getDashes() << "\n"; | ||||
|             stream << getLineOfChars<'-'>() << "\n"; | ||||
|         } | ||||
|         static std::string const& getDashes() { | ||||
|             static const std::string dashes( CATCH_CONFIG_CONSOLE_WIDTH-1, '-' ); | ||||
|             return dashes; | ||||
|         } | ||||
|         static std::string const& getDots() { | ||||
|             static const std::string dots( CATCH_CONFIG_CONSOLE_WIDTH-1, '.' ); | ||||
|             return dots; | ||||
|         } | ||||
|         static std::string const& getDoubleDashes() { | ||||
|             static const std::string doubleDashes( CATCH_CONFIG_CONSOLE_WIDTH-1, '=' ); | ||||
|             return doubleDashes; | ||||
|         } | ||||
|         static std::string const& getTildes() { | ||||
|             static const std::string dots( CATCH_CONFIG_CONSOLE_WIDTH-1, '~' ); | ||||
|             return dots; | ||||
|         template<char C> | ||||
|         static char const* getLineOfChars() { | ||||
|             static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; | ||||
|             if( !*line ) { | ||||
|                 memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); | ||||
|                 line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; | ||||
|             } | ||||
|             return line; | ||||
|         } | ||||
|  | ||||
|     private: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash