Refactored string wrapper

- to be much more flexible (writes to vector)
- fixed a couple of bugs
This commit is contained in:
Phil Nash
2013-03-27 19:08:16 +00:00
parent dd26e889b5
commit b052bd729a
6 changed files with 806 additions and 316 deletions

View File

@@ -211,7 +211,7 @@ namespace Catch {
if( result.hasExpandedExpression() ) {
stream << "with expansion:\n";
TextColour colourGuard( TextColour::ReconstructedExpression );
stream << wrapLongStrings( result.getExpandedExpression() ) << "\n";
stream << LineWrapper().setIndent(2).wrap( result.getExpandedExpression() ).toString() << "\n";
}
}
void printMessage() const {
@@ -219,8 +219,9 @@ namespace Catch {
stream << messageLabel << ":" << "\n";
for( std::vector<MessageInfo>::const_iterator it = messages.begin(), itEnd = messages.end();
it != itEnd;
++it ) {
stream << wrapLongStrings( it->message ) << "\n";
++it ) {
LineWrapper().setIndent(2).wrap( it->message ).intoStream( stream );
stream << "\n";
}
}
void printSourceInfo() const {
@@ -228,10 +229,6 @@ namespace Catch {
stream << result.getSourceInfo() << ": ";
}
static std::string wrapLongStrings( std::string const& _string ){
return Catch::wrapLongStrings( _string, CATCH_CONFIG_CONSOLE_WIDTH-1, 2 );
}
std::ostream& stream;
AssertionStats const& stats;
AssertionResult const& result;