mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Fully committed to new Text class.
- moved impl into .hpp - replaced last few uses of LineWrapper with Text - removed LineWrapper
This commit is contained in:
parent
97d99852a8
commit
b3acf45d70
@ -13,7 +13,6 @@
|
|||||||
#include "internal/catch_runner_impl.hpp"
|
#include "internal/catch_runner_impl.hpp"
|
||||||
#include "internal/catch_test_spec.h"
|
#include "internal/catch_test_spec.h"
|
||||||
#include "internal/catch_version.h"
|
#include "internal/catch_version.h"
|
||||||
#include "internal/catch_line_wrap.h"
|
|
||||||
#include "internal/catch_text.h"
|
#include "internal/catch_text.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -162,7 +161,6 @@ namespace Catch {
|
|||||||
displayedSpecificOption = true;
|
displayedSpecificOption = true;
|
||||||
std::cout << "\n" << opt.optionNames() << " " << opt.argsSynopsis() << "\n\n"
|
std::cout << "\n" << opt.optionNames() << " " << opt.argsSynopsis() << "\n\n"
|
||||||
<< opt.optionSummary() << "\n\n"
|
<< opt.optionSummary() << "\n\n"
|
||||||
// << LineWrapper().setIndent( 2 ).wrap( opt.optionDescription() ) << "\n" << std::endl;
|
|
||||||
<< Text( opt.optionDescription(), TextAttributes().setIndent( 2 ) ) << "\n" << std::endl;
|
<< Text( opt.optionDescription(), TextAttributes().setIndent( 2 ) ) << "\n" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "catch_test_case_info.hpp"
|
#include "catch_test_case_info.hpp"
|
||||||
#include "catch_tags.hpp"
|
#include "catch_tags.hpp"
|
||||||
#include "catch_version.hpp"
|
#include "catch_version.hpp"
|
||||||
#include "catch_line_wrap.hpp"
|
#include "catch_text.hpp"
|
||||||
#include "catch_message.hpp"
|
#include "catch_message.hpp"
|
||||||
#include "catch_legacy_reporter_adapter.hpp"
|
#include "catch_legacy_reporter_adapter.hpp"
|
||||||
|
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 11/1/2013.
|
|
||||||
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_LINE_WRAP_H_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_LINE_WRAP_H_INCLUDED
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
class LineWrapper {
|
|
||||||
public:
|
|
||||||
LineWrapper();
|
|
||||||
|
|
||||||
LineWrapper& setIndent( std::size_t _indent );
|
|
||||||
LineWrapper& setInitialIndent( std::size_t _initalIndent );
|
|
||||||
LineWrapper& setRight( std::size_t _right );
|
|
||||||
LineWrapper& setTabChar( char _tabChar );
|
|
||||||
|
|
||||||
LineWrapper& wrap( std::string const& _str );
|
|
||||||
|
|
||||||
std::string toString() const;
|
|
||||||
|
|
||||||
typedef std::vector<std::string>::const_iterator const_iterator;
|
|
||||||
|
|
||||||
const_iterator begin() const { return lines.begin(); }
|
|
||||||
const_iterator end() const { return lines.end(); }
|
|
||||||
std::string const& last() const { return lines.back(); }
|
|
||||||
std::size_t size() const { return lines.size(); }
|
|
||||||
std::string const& operator[]( std::size_t _index ) const { return lines[_index]; }
|
|
||||||
|
|
||||||
friend std::ostream& operator << ( std::ostream& _stream, LineWrapper const& _lineWrapper );
|
|
||||||
|
|
||||||
private:
|
|
||||||
void wrapInternal( std::string const& _str );
|
|
||||||
void addLine( const std::string& _line );
|
|
||||||
bool isWrapPoint( char c );
|
|
||||||
std::size_t getCurrentIndent() const;
|
|
||||||
|
|
||||||
std::size_t right;
|
|
||||||
std::size_t nextTab;
|
|
||||||
std::size_t tab;
|
|
||||||
std::size_t indent;
|
|
||||||
std::size_t initialIndent;
|
|
||||||
std::string wrappableChars;
|
|
||||||
char tabChar;
|
|
||||||
int recursionCount;
|
|
||||||
std::vector<std::string> lines;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_LINE_WRAP_H_INCLUDED
|
|
@ -1,117 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 11/1/2013.
|
|
||||||
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_LINE_WRAP_HPP_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_LINE_WRAP_HPP_INCLUDED
|
|
||||||
|
|
||||||
#include "catch_line_wrap.h"
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
LineWrapper::LineWrapper()
|
|
||||||
: right( CATCH_CONFIG_CONSOLE_WIDTH-1 ),
|
|
||||||
nextTab( 0 ),
|
|
||||||
tab( 0 ),
|
|
||||||
indent( 0 ),
|
|
||||||
initialIndent( (std::size_t)-1 ), // use indent by default
|
|
||||||
wrappableChars( " [({.,/|\\" ),
|
|
||||||
tabChar( '\t' ),
|
|
||||||
recursionCount( 0 )
|
|
||||||
{}
|
|
||||||
|
|
||||||
LineWrapper& LineWrapper::setIndent( std::size_t _indent ) {
|
|
||||||
indent = _indent;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
LineWrapper& LineWrapper::setInitialIndent( std::size_t _initialIndent ) {
|
|
||||||
initialIndent = _initialIndent;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
LineWrapper& LineWrapper::setRight( std::size_t _right ) {
|
|
||||||
right = _right;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
LineWrapper& LineWrapper::wrap( std::string const& _str ) {
|
|
||||||
nextTab = tab = 0;
|
|
||||||
wrapInternal( _str );
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
LineWrapper& LineWrapper::setTabChar( char _tabChar ) {
|
|
||||||
tabChar = _tabChar;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
bool LineWrapper::isWrapPoint( char c ) {
|
|
||||||
return wrappableChars.find( c ) != std::string::npos;
|
|
||||||
}
|
|
||||||
void LineWrapper::wrapInternal( std::string const& _str ) {
|
|
||||||
assert( ++recursionCount < 1000 );
|
|
||||||
|
|
||||||
std::size_t width = right - getCurrentIndent();
|
|
||||||
std::size_t wrapPoint = width-tab;
|
|
||||||
for( std::size_t pos = 0; pos < _str.size(); ++pos ) {
|
|
||||||
if( _str[pos] == '\n' )
|
|
||||||
{
|
|
||||||
addLine( _str.substr( 0, pos ) );
|
|
||||||
nextTab = tab = 0;
|
|
||||||
return wrapInternal( _str.substr( pos+1 ) );
|
|
||||||
}
|
|
||||||
if( pos == width-tab ) {
|
|
||||||
if( _str[wrapPoint] == ' ' ) {
|
|
||||||
addLine( _str.substr( 0, wrapPoint ) );
|
|
||||||
while( _str[++wrapPoint] == ' ' );
|
|
||||||
}
|
|
||||||
else if( isWrapPoint( _str[wrapPoint] ) ) {
|
|
||||||
addLine( _str.substr( 0, wrapPoint ) );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
addLine( _str.substr( 0, --wrapPoint ) + '-' );
|
|
||||||
}
|
|
||||||
return wrapInternal( _str.substr( wrapPoint ) );
|
|
||||||
}
|
|
||||||
if( _str[pos] == tabChar ) {
|
|
||||||
nextTab = pos;
|
|
||||||
std::string withoutTab = _str.substr( 0, nextTab ) + _str.substr( nextTab+1 );
|
|
||||||
return wrapInternal( withoutTab );
|
|
||||||
}
|
|
||||||
else if( pos > 0 && isWrapPoint( _str[pos] ) ) {
|
|
||||||
wrapPoint = pos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addLine( _str );
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator << ( std::ostream& _stream, LineWrapper const& _lineWrapper ) {
|
|
||||||
for( LineWrapper::const_iterator it = _lineWrapper.begin(), itEnd = _lineWrapper.end();
|
|
||||||
it != itEnd; ++it ) {
|
|
||||||
if( it != _lineWrapper.begin() )
|
|
||||||
_stream << "\n";
|
|
||||||
_stream << *it;
|
|
||||||
}
|
|
||||||
return _stream;
|
|
||||||
}
|
|
||||||
std::string LineWrapper::toString() const {
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << *this;
|
|
||||||
return oss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LineWrapper::addLine( const std::string& _line ) {
|
|
||||||
lines.push_back( std::string( tab + getCurrentIndent(), ' ' ) + _line );
|
|
||||||
if( nextTab > 0 )
|
|
||||||
tab = nextTab;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t LineWrapper::getCurrentIndent() const
|
|
||||||
{
|
|
||||||
return (initialIndent != (std::size_t)-1 && lines.empty() )
|
|
||||||
? initialIndent
|
|
||||||
: indent;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_LINE_WRAP_HPP_INCLUDED
|
|
@ -9,7 +9,7 @@
|
|||||||
#define TWOBLUECUBES_CATCH_LIST_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_LIST_HPP_INCLUDED
|
||||||
|
|
||||||
#include "catch_commandline.hpp"
|
#include "catch_commandline.hpp"
|
||||||
#include "catch_line_wrap.h"
|
#include "catch_text.h"
|
||||||
#include "catch_console_colour.hpp"
|
#include "catch_console_colour.hpp"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -57,11 +57,11 @@ namespace Catch {
|
|||||||
if( matchesFilters( config.filters, *it ) ) {
|
if( matchesFilters( config.filters, *it ) ) {
|
||||||
matchedTests++;
|
matchedTests++;
|
||||||
// !TBD: consider listAs()
|
// !TBD: consider listAs()
|
||||||
LineWrapper nameWrapper;
|
Text nameWrapper( it->getTestCaseInfo().name,
|
||||||
nameWrapper.setRight( maxNameLen ).setIndent( 2 ).wrap( it->getTestCaseInfo().name );
|
TextAttributes().setWidth( maxNameLen ).setIndent(2) );
|
||||||
|
|
||||||
LineWrapper tagsWrapper;
|
Text tagsWrapper( it->getTestCaseInfo().tagsAsString,
|
||||||
tagsWrapper.setRight( maxTagLen ).wrap( it->getTestCaseInfo().tagsAsString );
|
TextAttributes().setWidth( maxTagLen ) );
|
||||||
|
|
||||||
for( std::size_t i = 0; i < std::max( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
|
for( std::size_t i = 0; i < std::max( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
|
||||||
Colour::Code colour = Colour::None;
|
Colour::Code colour = Colour::None;
|
||||||
@ -135,9 +135,9 @@ namespace Catch {
|
|||||||
for( std::map<std::string, int>::const_iterator countIt = tagCounts.begin(), countItEnd = tagCounts.end();
|
for( std::map<std::string, int>::const_iterator countIt = tagCounts.begin(), countItEnd = tagCounts.end();
|
||||||
countIt != countItEnd;
|
countIt != countItEnd;
|
||||||
++countIt ) {
|
++countIt ) {
|
||||||
LineWrapper wrapper;
|
Text wrapper( "[" + countIt->first + "]", TextAttributes()
|
||||||
wrapper.setIndent(2).setRight( maxTagLen ).wrap( "[" + countIt->first + "]" );
|
.setIndent(2)
|
||||||
|
.setWidth( maxTagLen ) );
|
||||||
std::cout << wrapper;
|
std::cout << wrapper;
|
||||||
std::size_t dots = 2;
|
std::size_t dots = 2;
|
||||||
if( maxTagLen > wrapper.last().size() )
|
if( maxTagLen > wrapper.last().size() )
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
|
||||||
|
|
||||||
#include "catch_common.h"
|
#include "catch_common.h"
|
||||||
|
#include "catch_ptr.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_TEXT_H_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_TEXT_H_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_TEXT_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_TEXT_H_INCLUDED
|
||||||
|
|
||||||
|
#include "catch_config.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -34,62 +36,8 @@ namespace Catch {
|
|||||||
|
|
||||||
class Text {
|
class Text {
|
||||||
public:
|
public:
|
||||||
Text( std::string const& _str, TextAttributes const& _attr = TextAttributes() )
|
Text( std::string const& _str, TextAttributes const& _attr = TextAttributes() );
|
||||||
: attr( _attr )
|
void spliceLine( std::size_t _indent, std::string& _remainder, std::size_t _pos );
|
||||||
{
|
|
||||||
std::string wrappableChars = " [({.,/|\\-";
|
|
||||||
std::size_t indent = _attr.initialIndent != std::string::npos
|
|
||||||
? _attr.initialIndent
|
|
||||||
: _attr.indent;
|
|
||||||
std::string remainder = _str;
|
|
||||||
|
|
||||||
while( !remainder.empty() ) {
|
|
||||||
assert( lines.size() < 1000 );
|
|
||||||
std::size_t tabPos = std::string::npos;
|
|
||||||
std::size_t width = (std::min)( remainder.size(), _attr.width - indent );
|
|
||||||
std::size_t pos = remainder.find_first_of( '\n' );
|
|
||||||
if( pos <= width ) {
|
|
||||||
width = pos;
|
|
||||||
}
|
|
||||||
pos = remainder.find_last_of( _attr.tabChar, width );
|
|
||||||
if( pos != std::string::npos ) {
|
|
||||||
tabPos = pos;
|
|
||||||
if( remainder[width] == '\n' )
|
|
||||||
width--;
|
|
||||||
remainder = remainder.substr( 0, tabPos ) + remainder.substr( tabPos+1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( width == remainder.size() ) {
|
|
||||||
spliceLine( indent, remainder, width );
|
|
||||||
}
|
|
||||||
else if( remainder[width] == '\n' ) {
|
|
||||||
spliceLine( indent, remainder, width );
|
|
||||||
if( width <= 1 || remainder.size() != 1 )
|
|
||||||
remainder = remainder.substr( 1 );
|
|
||||||
indent = _attr.indent;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pos = remainder.find_last_of( wrappableChars, width );
|
|
||||||
if( pos != std::string::npos ) {
|
|
||||||
spliceLine( indent, remainder, pos );
|
|
||||||
if( remainder[0] == ' ' )
|
|
||||||
remainder = remainder.substr( 1 );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
spliceLine( indent, remainder, width-1 );
|
|
||||||
lines.back() += "-";
|
|
||||||
}
|
|
||||||
if( lines.size() == 1 )
|
|
||||||
indent = _attr.indent;
|
|
||||||
if( tabPos != std::string::npos )
|
|
||||||
indent += tabPos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void spliceLine( std::size_t _indent, std::string& _remainder, std::size_t _pos ) {
|
|
||||||
lines.push_back( std::string( _indent, ' ' ) + _remainder.substr( 0, _pos ) );
|
|
||||||
_remainder = _remainder.substr( _pos );
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef std::vector<std::string>::const_iterator const_iterator;
|
typedef std::vector<std::string>::const_iterator const_iterator;
|
||||||
|
|
||||||
@ -98,21 +46,9 @@ namespace Catch {
|
|||||||
std::string const& last() const { return lines.back(); }
|
std::string const& last() const { return lines.back(); }
|
||||||
std::size_t size() const { return lines.size(); }
|
std::size_t size() const { return lines.size(); }
|
||||||
std::string const& operator[]( std::size_t _index ) const { return lines[_index]; }
|
std::string const& operator[]( std::size_t _index ) const { return lines[_index]; }
|
||||||
|
std::string toString() const;
|
||||||
|
|
||||||
friend std::ostream& operator << ( std::ostream& _stream, Text const& _text ) {
|
friend std::ostream& operator << ( std::ostream& _stream, Text const& _text );
|
||||||
for( Text::const_iterator it = _text.begin(), itEnd = _text.end();
|
|
||||||
it != itEnd; ++it ) {
|
|
||||||
if( it != _text.begin() )
|
|
||||||
_stream << "\n";
|
|
||||||
_stream << *it;
|
|
||||||
}
|
|
||||||
return _stream;
|
|
||||||
}
|
|
||||||
std::string toString() const {
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << *this;
|
|
||||||
return oss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string str;
|
std::string str;
|
||||||
|
92
include/internal/catch_text.hpp
Normal file
92
include/internal/catch_text.hpp
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Created by Phil on 20/4/2013.
|
||||||
|
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#ifndef TWOBLUECUBES_CATCH_TEXT_HPP_INCLUDED
|
||||||
|
#define TWOBLUECUBES_CATCH_TEXT_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
|
Text::Text( std::string const& _str, TextAttributes const& _attr )
|
||||||
|
: attr( _attr )
|
||||||
|
{
|
||||||
|
std::string wrappableChars = " [({.,/|\\-";
|
||||||
|
std::size_t indent = _attr.initialIndent != std::string::npos
|
||||||
|
? _attr.initialIndent
|
||||||
|
: _attr.indent;
|
||||||
|
std::string remainder = _str;
|
||||||
|
|
||||||
|
while( !remainder.empty() ) {
|
||||||
|
assert( lines.size() < 1000 );
|
||||||
|
std::size_t tabPos = std::string::npos;
|
||||||
|
std::size_t width = (std::min)( remainder.size(), _attr.width - indent );
|
||||||
|
std::size_t pos = remainder.find_first_of( '\n' );
|
||||||
|
if( pos <= width ) {
|
||||||
|
width = pos;
|
||||||
|
}
|
||||||
|
pos = remainder.find_last_of( _attr.tabChar, width );
|
||||||
|
if( pos != std::string::npos ) {
|
||||||
|
tabPos = pos;
|
||||||
|
if( remainder[width] == '\n' )
|
||||||
|
width--;
|
||||||
|
remainder = remainder.substr( 0, tabPos ) + remainder.substr( tabPos+1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( width == remainder.size() ) {
|
||||||
|
spliceLine( indent, remainder, width );
|
||||||
|
}
|
||||||
|
else if( remainder[width] == '\n' ) {
|
||||||
|
spliceLine( indent, remainder, width );
|
||||||
|
if( width <= 1 || remainder.size() != 1 )
|
||||||
|
remainder = remainder.substr( 1 );
|
||||||
|
indent = _attr.indent;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pos = remainder.find_last_of( wrappableChars, width );
|
||||||
|
if( pos != std::string::npos && pos > 0 ) {
|
||||||
|
spliceLine( indent, remainder, pos );
|
||||||
|
if( remainder[0] == ' ' )
|
||||||
|
remainder = remainder.substr( 1 );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
spliceLine( indent, remainder, width-1 );
|
||||||
|
lines.back() += "-";
|
||||||
|
}
|
||||||
|
if( lines.size() == 1 )
|
||||||
|
indent = _attr.indent;
|
||||||
|
if( tabPos != std::string::npos )
|
||||||
|
indent += tabPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Text::spliceLine( std::size_t _indent, std::string& _remainder, std::size_t _pos ) {
|
||||||
|
lines.push_back( std::string( _indent, ' ' ) + _remainder.substr( 0, _pos ) );
|
||||||
|
_remainder = _remainder.substr( _pos );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Text::toString() const {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << *this;
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream& operator << ( std::ostream& _stream, Text const& _text ) {
|
||||||
|
for( Text::const_iterator it = _text.begin(), itEnd = _text.end();
|
||||||
|
it != itEnd; ++it ) {
|
||||||
|
if( it != _text.begin() )
|
||||||
|
_stream << "\n";
|
||||||
|
_stream << *it;
|
||||||
|
}
|
||||||
|
return _stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end namespace Catch
|
||||||
|
|
||||||
|
#endif // TWOBLUECUBES_CATCH_TEXT_HPP_INCLUDED
|
@ -203,7 +203,7 @@ namespace Catch {
|
|||||||
if( result.hasExpandedExpression() ) {
|
if( result.hasExpandedExpression() ) {
|
||||||
stream << "with expansion:\n";
|
stream << "with expansion:\n";
|
||||||
Colour colourGuard( Colour::ReconstructedExpression );
|
Colour colourGuard( Colour::ReconstructedExpression );
|
||||||
stream << LineWrapper().setIndent(2).wrap( result.getExpandedExpression() ) << "\n";
|
stream << Text( result.getExpandedExpression(), TextAttributes().setIndent(2) ) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void printMessage() const {
|
void printMessage() const {
|
||||||
@ -212,7 +212,7 @@ namespace Catch {
|
|||||||
for( std::vector<MessageInfo>::const_iterator it = messages.begin(), itEnd = messages.end();
|
for( std::vector<MessageInfo>::const_iterator it = messages.begin(), itEnd = messages.end();
|
||||||
it != itEnd;
|
it != itEnd;
|
||||||
++it ) {
|
++it ) {
|
||||||
stream << LineWrapper().setIndent(2).wrap( it->message ) << "\n";
|
stream << Text( it->message, TextAttributes().setIndent(2) ) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void printSourceInfo() const {
|
void printSourceInfo() const {
|
||||||
@ -313,10 +313,9 @@ namespace Catch {
|
|||||||
i+=2;
|
i+=2;
|
||||||
else
|
else
|
||||||
i = 0;
|
i = 0;
|
||||||
stream << LineWrapper()
|
stream << Text( _string, TextAttributes()
|
||||||
.setIndent( indent+i)
|
.setIndent( indent+i)
|
||||||
.setInitialIndent( indent )
|
.setInitialIndent( indent ) ) << "\n";
|
||||||
.wrap( _string ) << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void printTotals( const Totals& totals ) {
|
void printTotals( const Totals& totals ) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "catch_self_test.hpp"
|
#include "catch_self_test.hpp"
|
||||||
#include "internal/catch_line_wrap.h"
|
|
||||||
#include "internal/catch_text.h"
|
#include "internal/catch_text.h"
|
||||||
|
|
||||||
TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" ) {
|
TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" ) {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */; };
|
266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */; };
|
||||||
266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266ECD73170F3C620030D735 /* BDDTests.cpp */; };
|
266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 266ECD73170F3C620030D735 /* BDDTests.cpp */; };
|
||||||
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26847E5D16BBADB40043B9C1 /* catch_message.cpp */; };
|
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26847E5D16BBADB40043B9C1 /* catch_message.cpp */; };
|
||||||
2694A1FD16A0000E004816E3 /* catch_line_wrap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */; };
|
2694A1FD16A0000E004816E3 /* catch_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_text.cpp */; };
|
||||||
4A45DA2416161EF9004F8D6B /* catch_console_colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */; };
|
4A45DA2416161EF9004F8D6B /* catch_console_colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */; };
|
||||||
4A45DA2716161F1F004F8D6B /* catch_ptr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2616161F1F004F8D6B /* catch_ptr.cpp */; };
|
4A45DA2716161F1F004F8D6B /* catch_ptr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2616161F1F004F8D6B /* catch_ptr.cpp */; };
|
||||||
4A45DA2916161F3D004F8D6B /* catch_streambuf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2816161F3D004F8D6B /* catch_streambuf.cpp */; };
|
4A45DA2916161F3D004F8D6B /* catch_streambuf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2816161F3D004F8D6B /* catch_streambuf.cpp */; };
|
||||||
@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VariadicMacrosTests.cpp; path = ../../../SelfTest/VariadicMacrosTests.cpp; sourceTree = "<group>"; };
|
266B06B616F3A60A004ED264 /* VariadicMacrosTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VariadicMacrosTests.cpp; path = ../../../SelfTest/VariadicMacrosTests.cpp; sourceTree = "<group>"; };
|
||||||
|
266E9AD117230ACF0061DAB2 /* catch_text.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_text.hpp; sourceTree = "<group>"; };
|
||||||
266ECD73170F3C620030D735 /* BDDTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BDDTests.cpp; path = ../../../SelfTest/BDDTests.cpp; sourceTree = "<group>"; };
|
266ECD73170F3C620030D735 /* BDDTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BDDTests.cpp; path = ../../../SelfTest/BDDTests.cpp; sourceTree = "<group>"; };
|
||||||
266ECD8C1713614B0030D735 /* catch_legacy_reporter_adapter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_legacy_reporter_adapter.hpp; sourceTree = "<group>"; };
|
266ECD8C1713614B0030D735 /* catch_legacy_reporter_adapter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_legacy_reporter_adapter.hpp; sourceTree = "<group>"; };
|
||||||
266ECD8D1713614B0030D735 /* catch_legacy_reporter_adapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_legacy_reporter_adapter.h; sourceTree = "<group>"; };
|
266ECD8D1713614B0030D735 /* catch_legacy_reporter_adapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_legacy_reporter_adapter.h; sourceTree = "<group>"; };
|
||||||
@ -64,9 +65,7 @@
|
|||||||
26847E5B16BBAB790043B9C1 /* catch_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_message.h; sourceTree = "<group>"; };
|
26847E5B16BBAB790043B9C1 /* catch_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_message.h; sourceTree = "<group>"; };
|
||||||
26847E5C16BBACB60043B9C1 /* catch_message.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_message.hpp; sourceTree = "<group>"; };
|
26847E5C16BBACB60043B9C1 /* catch_message.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_message.hpp; sourceTree = "<group>"; };
|
||||||
26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = "<group>"; };
|
26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = "<group>"; };
|
||||||
2694A1F8169FFF9B004816E3 /* catch_line_wrap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_line_wrap.h; sourceTree = "<group>"; };
|
2694A1FB16A0000E004816E3 /* catch_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_text.cpp; sourceTree = "<group>"; };
|
||||||
2694A1FA169FFFEC004816E3 /* catch_line_wrap.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_line_wrap.hpp; sourceTree = "<group>"; };
|
|
||||||
2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_line_wrap.cpp; sourceTree = "<group>"; };
|
|
||||||
26DACF2F17206D3400A21326 /* catch_text.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_text.h; sourceTree = "<group>"; };
|
26DACF2F17206D3400A21326 /* catch_text.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_text.h; sourceTree = "<group>"; };
|
||||||
4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_info.hpp; sourceTree = "<group>"; };
|
4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_info.hpp; sourceTree = "<group>"; };
|
||||||
4A084F1D15DAD15F0027E631 /* catch_test_spec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_test_spec.h; sourceTree = "<group>"; };
|
4A084F1D15DAD15F0027E631 /* catch_test_spec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_test_spec.h; sourceTree = "<group>"; };
|
||||||
@ -286,7 +285,7 @@
|
|||||||
4AB3D99F1616219100C9A0F8 /* catch_interfaces_config.cpp */,
|
4AB3D99F1616219100C9A0F8 /* catch_interfaces_config.cpp */,
|
||||||
4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */,
|
4AB3D9A1161621B500C9A0F8 /* catch_interfaces_generators.cpp */,
|
||||||
4ACE21CA166CA1B300FB5509 /* catch_option.cpp */,
|
4ACE21CA166CA1B300FB5509 /* catch_option.cpp */,
|
||||||
2694A1FB16A0000E004816E3 /* catch_line_wrap.cpp */,
|
2694A1FB16A0000E004816E3 /* catch_text.cpp */,
|
||||||
26847E5D16BBADB40043B9C1 /* catch_message.cpp */,
|
26847E5D16BBADB40043B9C1 /* catch_message.cpp */,
|
||||||
);
|
);
|
||||||
name = SurrogateCpps;
|
name = SurrogateCpps;
|
||||||
@ -295,6 +294,7 @@
|
|||||||
4AC91CB4155B9EBF00DC5117 /* impl */ = {
|
4AC91CB4155B9EBF00DC5117 /* impl */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
266E9AD117230ACF0061DAB2 /* catch_text.hpp */,
|
||||||
4A4B0F9C15CEFA8300AE2392 /* catch_impl.hpp */,
|
4A4B0F9C15CEFA8300AE2392 /* catch_impl.hpp */,
|
||||||
4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */,
|
4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */,
|
||||||
4A6D0C50149B3E3D00DB3EAA /* catch_generators_impl.hpp */,
|
4A6D0C50149B3E3D00DB3EAA /* catch_generators_impl.hpp */,
|
||||||
@ -306,7 +306,6 @@
|
|||||||
4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */,
|
4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */,
|
||||||
4A90B59E15D2521E00EF71BC /* catch_expressionresult_builder.hpp */,
|
4A90B59E15D2521E00EF71BC /* catch_expressionresult_builder.hpp */,
|
||||||
4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */,
|
4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */,
|
||||||
2694A1FA169FFFEC004816E3 /* catch_line_wrap.hpp */,
|
|
||||||
26847E5C16BBACB60043B9C1 /* catch_message.hpp */,
|
26847E5C16BBACB60043B9C1 /* catch_message.hpp */,
|
||||||
);
|
);
|
||||||
name = impl;
|
name = impl;
|
||||||
@ -397,7 +396,6 @@
|
|||||||
4AB77CB51551AEA200857BF0 /* catch_ptr.hpp */,
|
4AB77CB51551AEA200857BF0 /* catch_ptr.hpp */,
|
||||||
4AEE0326161431070071E950 /* catch_streambuf.h */,
|
4AEE0326161431070071E950 /* catch_streambuf.h */,
|
||||||
4ACE21C8166CA19700FB5509 /* catch_option.hpp */,
|
4ACE21C8166CA19700FB5509 /* catch_option.hpp */,
|
||||||
2694A1F8169FFF9B004816E3 /* catch_line_wrap.h */,
|
|
||||||
26759472171C72A400A84BD1 /* catch_sfinae.hpp */,
|
26759472171C72A400A84BD1 /* catch_sfinae.hpp */,
|
||||||
26759473171C74C200A84BD1 /* catch_compiler_capabilities.h */,
|
26759473171C74C200A84BD1 /* catch_compiler_capabilities.h */,
|
||||||
26DACF2F17206D3400A21326 /* catch_text.h */,
|
26DACF2F17206D3400A21326 /* catch_text.h */,
|
||||||
@ -491,7 +489,7 @@
|
|||||||
4AB3D9A01616219100C9A0F8 /* catch_interfaces_config.cpp in Sources */,
|
4AB3D9A01616219100C9A0F8 /* catch_interfaces_config.cpp in Sources */,
|
||||||
4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */,
|
4AB3D9A2161621B500C9A0F8 /* catch_interfaces_generators.cpp in Sources */,
|
||||||
4ACE21CC166CA1B300FB5509 /* catch_option.cpp in Sources */,
|
4ACE21CC166CA1B300FB5509 /* catch_option.cpp in Sources */,
|
||||||
2694A1FD16A0000E004816E3 /* catch_line_wrap.cpp in Sources */,
|
2694A1FD16A0000E004816E3 /* catch_text.cpp in Sources */,
|
||||||
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */,
|
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */,
|
||||||
266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */,
|
266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */,
|
||||||
266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */,
|
266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */,
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
// This file is only here to verify (to the extent possible) the self sufficiency of the header
|
// This file is only here to verify (to the extent possible) the self sufficiency of the header
|
||||||
#include "catch_line_wrap.h"
|
#include "catch_text.h"
|
Loading…
Reference in New Issue
Block a user