Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2017-07-10 14:25:38 +0200
committerMartin Hořeňovský2017-07-10 14:25:38 +0200
commit1d3bfa035344299f3fa1404ed0d138cf97d59fd5 (patch)
tree73a5bdab120234d77bfa01b174a864696c43c745 /include
parent5f3f19de0845c9bc4358dbef51af6827b13c0889 (diff)
downloadcatch3-1d3bfa035344299f3fa1404ed0d138cf97d59fd5.tar.gz
More include and impl refactoring
Diffstat (limited to 'include')
-rw-r--r--include/catch_session.hpp3
-rw-r--r--include/internal/catch_commandline.cpp163
-rw-r--r--include/internal/catch_commandline.hpp149
-rw-r--r--include/internal/catch_console_colour.cpp4
-rw-r--r--include/internal/catch_console_colour.hpp2
-rw-r--r--include/internal/catch_exception_translator_registry.cpp63
-rw-r--r--include/internal/catch_exception_translator_registry.h29
-rw-r--r--include/internal/catch_exception_translator_registry.hpp74
-rw-r--r--include/internal/catch_list.cpp (renamed from include/internal/catch_list.hpp)49
-rw-r--r--include/internal/catch_list.h36
-rw-r--r--include/internal/catch_registry_hub.cpp2
-rw-r--r--include/reporters/catch_reporter_console.cpp5
12 files changed, 324 insertions, 255 deletions
diff --git a/include/catch_session.hpp b/include/catch_session.hpp
index 42080cd1..7acf80a6 100644
--- a/include/catch_session.hpp
+++ b/include/catch_session.hpp
@@ -9,7 +9,8 @@
#define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
#include "internal/catch_commandline.hpp"
-#include "internal/catch_list.hpp"
+#include "internal/catch_console_colour.hpp"
+#include "internal/catch_list.h"
#include "internal/catch_run_context.hpp"
#include "internal/catch_test_spec.hpp"
#include "internal/catch_version.h"
diff --git a/include/internal/catch_commandline.cpp b/include/internal/catch_commandline.cpp
new file mode 100644
index 00000000..d5f2ab4e
--- /dev/null
+++ b/include/internal/catch_commandline.cpp
@@ -0,0 +1,163 @@
+/*
+ * Created by Phil on 02/11/2010.
+ * Copyright 2010 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)
+ */
+
+#include "catch_commandline.hpp"
+
+#include "catch_common.h"
+
+#include <fstream>
+#include <ctime>
+
+namespace Catch {
+
+ clara::Parser makeCommandLineParser( ConfigData& config ) {
+
+ using namespace clara;
+
+ auto const setWarning = [&]( std::string const& warning ) {
+ if( warning != "NoAssertions" )
+ return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" );
+ config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
+ std::ifstream f( filename.c_str() );
+ if( !f.is_open() )
+ return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" );
+
+ std::string line;
+ while( std::getline( f, line ) ) {
+ line = trim(line);
+ if( !line.empty() && !startsWith( line, '#' ) ) {
+ if( !startsWith( line, '"' ) )
+ line = '"' + line + '"';
+ config.testsOrTags.push_back( line + ',' );
+ }
+ }
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setTestOrder = [&]( std::string const& order ) {
+ if( startsWith( "declared", order ) )
+ config.runOrder = RunTests::InDeclarationOrder;
+ else if( startsWith( "lexical", order ) )
+ config.runOrder = RunTests::InLexicographicalOrder;
+ else if( startsWith( "random", order ) )
+ config.runOrder = RunTests::InRandomOrder;
+ else
+ return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setRngSeed = [&]( std::string const& seed ) {
+ if( seed != "time" )
+ return clara::detail::convertInto( seed, config.rngSeed );
+ config.rngSeed = static_cast<unsigned int>( std::time(0) );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setColourUsage = [&]( std::string const& useColour ) {
+ auto mode = toLower( useColour );
+
+ if( mode == "yes" )
+ config.useColour = UseColour::Yes;
+ else if( mode == "no" )
+ config.useColour = UseColour::No;
+ else if( mode == "auto" )
+ config.useColour = UseColour::Auto;
+ else
+ return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setVerbosity = [&]( std::string const& verbosity ) {
+ auto lcVerbosity = toLower( verbosity );
+ if( lcVerbosity == "quiet" )
+ config.verbosity = Verbosity::Quiet;
+ else if( lcVerbosity == "normal" )
+ config.verbosity = Verbosity::Normal;
+ else if( lcVerbosity == "high" )
+ config.verbosity = Verbosity::High;
+ else
+ return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+
+ auto cli
+ = ExeName( config.processName )
+ + Help( config.showHelp )
+ + Opt( config.listTests )
+ ["-l"]["--list-tests"]
+ ( "list all/matching test cases" )
+ + Opt( config.listTags )
+ ["-t"]["--list-tags"]
+ ( "list all/matching tags" )
+ + Opt( config.showSuccessfulTests )
+ ["-s"]["--success"]
+ ( "include successful tests in output" )
+ + Opt( config.shouldDebugBreak )
+ ["-b"]["--break"]
+ ( "break into debugger on failure" )
+ + Opt( config.noThrow )
+ ["-e"]["--nothrow"]
+ ( "skip exception tests" )
+ + Opt( config.showInvisibles )
+ ["-i"]["--invisibles"]
+ ( "show invisibles (tabs, newlines)" )
+ + Opt( config.outputFilename, "filename" )
+ ["-o"]["--out"]
+ ( "output filename" )
+ + Opt( config.reporterNames, "name" )
+ ["-r"]["--reporter"]
+ ( "reporter to use (defaults to console)" )
+ + Opt( config.name, "name" )
+ ["-n"]["--name"]
+ ( "suite name" )
+ + Opt( [&]( bool ){ config.abortAfter = 1; } )
+ ["-a"]["--abort"]
+ ( "abort at first failure" )
+ + Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
+ ["-x"]["--abortx"]
+ ( "abort after x failures" )
+ + Opt( setWarning, "warning name" )
+ ["-w"]["--warn"]
+ ( "enable warnings" )
+ + Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } )
+ ["-d"]["--durations"]
+ ( "show test durations" )
+ + Opt( loadTestNamesFromFile, "filename" )
+ ["-f"]["--input-file"]
+ ( "load test names to run from a file" )
+ + Opt( config.filenamesAsTags )
+ ["-#"]["--filenames-as-tags"]
+ ( "adds a tag for the filename" )
+ + Opt( config.sectionsToRun, "section name" )
+ ["-c"]["--section"]
+ ( "specify section to run" )
+ + Opt( setVerbosity, "quiet|normal|high" )
+ ["-v"]["--verbosity"]
+ ( "set output verbosity" )
+ + Opt( config.listTestNamesOnly )
+ ["--list-test-names-only"]
+ ( "list all/matching test cases names only" )
+ + Opt( config.listReporters )
+ ["--list-reporters"]
+ ( "list all reporters" )
+ + Opt( setTestOrder, "decl|lex|rand" )
+ ["--order"]
+ ( "test case order (defaults to decl)" )
+ + Opt( setRngSeed, "'time'|number" )
+ ["--rng-seed"]
+ ( "set a specific seed for random numbers" )
+ + Opt( setColourUsage, "yes|no" )
+ ["--use-colour"]
+ ( "should output be colourised" )
+
+ + Arg( config.testsOrTags, "test name|pattern|tags" )
+ ( "which test or tests to use" );
+
+ return cli;
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp
index b81e9931..b73cfa2d 100644
--- a/include/internal/catch_commandline.hpp
+++ b/include/internal/catch_commandline.hpp
@@ -9,158 +9,11 @@
#define TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
#include "catch_config.hpp"
-#include "catch_common.h"
#include "catch_clara.h"
-#include <fstream>
-#include <ctime>
-
namespace Catch {
- inline clara::Parser makeCommandLineParser( ConfigData& config ) {
-
- using namespace clara;
-
- auto const setWarning = [&]( std::string const& warning ) {
- if( warning != "NoAssertions" )
- return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" );
- config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions );
- return ParserResult::ok( ParseResultType::Matched );
- };
- auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
- std::ifstream f( filename.c_str() );
- if( !f.is_open() )
- return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" );
-
- std::string line;
- while( std::getline( f, line ) ) {
- line = trim(line);
- if( !line.empty() && !startsWith( line, '#' ) ) {
- if( !startsWith( line, '"' ) )
- line = '"' + line + '"';
- config.testsOrTags.push_back( line + ',' );
- }
- }
- return ParserResult::ok( ParseResultType::Matched );
- };
- auto const setTestOrder = [&]( std::string const& order ) {
- if( startsWith( "declared", order ) )
- config.runOrder = RunTests::InDeclarationOrder;
- else if( startsWith( "lexical", order ) )
- config.runOrder = RunTests::InLexicographicalOrder;
- else if( startsWith( "random", order ) )
- config.runOrder = RunTests::InRandomOrder;
- else
- return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" );
- return ParserResult::ok( ParseResultType::Matched );
- };
- auto const setRngSeed = [&]( std::string const& seed ) {
- if( seed != "time" )
- return clara::detail::convertInto( seed, config.rngSeed );
- config.rngSeed = static_cast<unsigned int>( std::time(0) );
- return ParserResult::ok( ParseResultType::Matched );
- };
- auto const setColourUsage = [&]( std::string const& useColour ) {
- auto mode = toLower( useColour );
-
- if( mode == "yes" )
- config.useColour = UseColour::Yes;
- else if( mode == "no" )
- config.useColour = UseColour::No;
- else if( mode == "auto" )
- config.useColour = UseColour::Auto;
- else
- return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" );
- return ParserResult::ok( ParseResultType::Matched );
- };
- auto const setVerbosity = [&]( std::string const& verbosity ) {
- auto lcVerbosity = toLower( verbosity );
- if( lcVerbosity == "quiet" )
- config.verbosity = Verbosity::Quiet;
- else if( lcVerbosity == "normal" )
- config.verbosity = Verbosity::Normal;
- else if( lcVerbosity == "high" )
- config.verbosity = Verbosity::High;
- else
- return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" );
- return ParserResult::ok( ParseResultType::Matched );
- };
-
- auto cli
- = ExeName( config.processName )
- + Help( config.showHelp )
- + Opt( config.listTests )
- ["-l"]["--list-tests"]
- ( "list all/matching test cases" )
- + Opt( config.listTags )
- ["-t"]["--list-tags"]
- ( "list all/matching tags" )
- + Opt( config.showSuccessfulTests )
- ["-s"]["--success"]
- ( "include successful tests in output" )
- + Opt( config.shouldDebugBreak )
- ["-b"]["--break"]
- ( "break into debugger on failure" )
- + Opt( config.noThrow )
- ["-e"]["--nothrow"]
- ( "skip exception tests" )
- + Opt( config.showInvisibles )
- ["-i"]["--invisibles"]
- ( "show invisibles (tabs, newlines)" )
- + Opt( config.outputFilename, "filename" )
- ["-o"]["--out"]
- ( "output filename" )
- + Opt( config.reporterNames, "name" )
- ["-r"]["--reporter"]
- ( "reporter to use (defaults to console)" )
- + Opt( config.name, "name" )
- ["-n"]["--name"]
- ( "suite name" )
- + Opt( [&]( bool ){ config.abortAfter = 1; } )
- ["-a"]["--abort"]
- ( "abort at first failure" )
- + Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
- ["-x"]["--abortx"]
- ( "abort after x failures" )
- + Opt( setWarning, "warning name" )
- ["-w"]["--warn"]
- ( "enable warnings" )
- + Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } )
- ["-d"]["--durations"]
- ( "show test durations" )
- + Opt( loadTestNamesFromFile, "filename" )
- ["-f"]["--input-file"]
- ( "load test names to run from a file" )
- + Opt( config.filenamesAsTags )
- ["-#"]["--filenames-as-tags"]
- ( "adds a tag for the filename" )
- + Opt( config.sectionsToRun, "section name" )
- ["-c"]["--section"]
- ( "specify section to run" )
- + Opt( setVerbosity, "quiet|normal|high" )
- ["-v"]["--verbosity"]
- ( "set output verbosity" )
- + Opt( config.listTestNamesOnly )
- ["--list-test-names-only"]
- ( "list all/matching test cases names only" )
- + Opt( config.listReporters )
- ["--list-reporters"]
- ( "list all reporters" )
- + Opt( setTestOrder, "decl|lex|rand" )
- ["--order"]
- ( "test case order (defaults to decl)" )
- + Opt( setRngSeed, "'time'|number" )
- ["--rng-seed"]
- ( "set a specific seed for random numbers" )
- + Opt( setColourUsage, "yes|no" )
- ["--use-colour"]
- ( "should output be colourised" )
-
- + Arg( config.testsOrTags, "test name|pattern|tags" )
- ( "which test or tests to use" );
-
- return cli;
- }
+ clara::Parser makeCommandLineParser( ConfigData& config );
} // end namespace Catch
diff --git a/include/internal/catch_console_colour.cpp b/include/internal/catch_console_colour.cpp
index 5670b8bf..6ffe7ba5 100644
--- a/include/internal/catch_console_colour.cpp
+++ b/include/internal/catch_console_colour.cpp
@@ -187,4 +187,8 @@ namespace Catch {
impl->use( _colourCode );
}
+ std::ostream& operator << ( std::ostream& os, Colour const& ) {
+ return os;
+ }
+
} // end namespace Catch
diff --git a/include/internal/catch_console_colour.hpp b/include/internal/catch_console_colour.hpp
index f0a8a697..7122decc 100644
--- a/include/internal/catch_console_colour.hpp
+++ b/include/internal/catch_console_colour.hpp
@@ -60,7 +60,7 @@ namespace Catch {
bool m_moved;
};
- inline std::ostream& operator << ( std::ostream& os, Colour const& ) { return os; }
+ std::ostream& operator << ( std::ostream& os, Colour const& );
} // end namespace Catch
diff --git a/include/internal/catch_exception_translator_registry.cpp b/include/internal/catch_exception_translator_registry.cpp
new file mode 100644
index 00000000..18e7c0b6
--- /dev/null
+++ b/include/internal/catch_exception_translator_registry.cpp
@@ -0,0 +1,63 @@
+/*
+ * Created by Phil on 20/04/2011.
+ * Copyright 2011 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)
+ */
+
+#include "catch_exception_translator_registry.h"
+#include "catch_result_builder.h"
+
+#ifdef __OBJC__
+#import "Foundation/Foundation.h"
+#endif
+
+namespace Catch {
+
+ ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {
+ deleteAll( m_translators );
+ }
+
+ void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) {
+ m_translators.push_back( translator );
+ }
+
+ std::string ExceptionTranslatorRegistry::translateActiveException() const {
+ try {
+#ifdef __OBJC__
+ // In Objective-C try objective-c exceptions first
+ @try {
+ return tryTranslators();
+ }
+ @catch (NSException *exception) {
+ return Catch::toString( [exception description] );
+ }
+#else
+ return tryTranslators();
+#endif
+ }
+ catch( TestFailureException& ) {
+ throw;
+ }
+ catch( std::exception& ex ) {
+ return ex.what();
+ }
+ catch( std::string& msg ) {
+ return msg;
+ }
+ catch( const char* msg ) {
+ return msg;
+ }
+ catch(...) {
+ return "Unknown exception";
+ }
+ }
+
+ std::string ExceptionTranslatorRegistry::tryTranslators() const {
+ if( m_translators.empty() )
+ throw;
+ else
+ return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
+ }
+}
diff --git a/include/internal/catch_exception_translator_registry.h b/include/internal/catch_exception_translator_registry.h
new file mode 100644
index 00000000..dc5d8159
--- /dev/null
+++ b/include/internal/catch_exception_translator_registry.h
@@ -0,0 +1,29 @@
+/*
+ * Created by Phil on 20/04/2011.
+ * Copyright 2011 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_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
+
+#include "catch_interfaces_exception.h"
+#include <vector>
+#include <string>
+
+namespace Catch {
+
+ class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {
+ public:
+ ~ExceptionTranslatorRegistry();
+ virtual void registerTranslator( const IExceptionTranslator* translator );
+ virtual std::string translateActiveException() const;
+ std::string tryTranslators() const;
+
+ private:
+ std::vector<const IExceptionTranslator*> m_translators;
+ };
+}
+
+#endif // TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
diff --git a/include/internal/catch_exception_translator_registry.hpp b/include/internal/catch_exception_translator_registry.hpp
deleted file mode 100644
index 07d83f21..00000000
--- a/include/internal/catch_exception_translator_registry.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Created by Phil on 20/04/2011.
- * Copyright 2011 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_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
-
-#include "catch_interfaces_exception.h"
-#include "catch_tostring.h"
-#include "catch_result_builder.h"
-
-#ifdef __OBJC__
-#import "Foundation/Foundation.h"
-#endif
-
-namespace Catch {
-
- class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {
- public:
- ~ExceptionTranslatorRegistry() {
- deleteAll( m_translators );
- }
-
- virtual void registerTranslator( const IExceptionTranslator* translator ) {
- m_translators.push_back( translator );
- }
-
- virtual std::string translateActiveException() const {
- try {
-#ifdef __OBJC__
- // In Objective-C try objective-c exceptions first
- @try {
- return tryTranslators();
- }
- @catch (NSException *exception) {
- return Catch::toString( [exception description] );
- }
-#else
- return tryTranslators();
-#endif
- }
- catch( TestFailureException& ) {
- throw;
- }
- catch( std::exception& ex ) {
- return ex.what();
- }
- catch( std::string& msg ) {
- return msg;
- }
- catch( const char* msg ) {
- return msg;
- }
- catch(...) {
- return "Unknown exception";
- }
- }
-
- std::string tryTranslators() const {
- if( m_translators.empty() )
- throw;
- else
- return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
- }
-
- private:
- std::vector<const IExceptionTranslator*> m_translators;
- };
-}
-
-#endif // TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.cpp
index 5d9d8ed4..8f13be8d 100644
--- a/include/internal/catch_list.hpp
+++ b/include/internal/catch_list.cpp
@@ -5,22 +5,24 @@
* 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_LIST_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_LIST_HPP_INCLUDED
-#include "catch_commandline.hpp"
+#include "catch_list.h"
+
+#include "catch_interfaces_registry_hub.h"
+#include "catch_interfaces_reporter.h"
+#include "catch_interfaces_testcase.h"
+
#include "catch_text.h"
#include "catch_console_colour.hpp"
-#include "catch_interfaces_reporter.h"
#include "catch_test_spec_parser.hpp"
#include <limits>
#include <algorithm>
+#include <iomanip>
namespace Catch {
- inline std::size_t listTests( Config const& config ) {
-
+ std::size_t listTests( Config const& config ) {
TestSpec testSpec = config.testSpec();
if( config.testSpec().hasFilters() )
Catch::cout() << "Matching test cases:\n";
@@ -62,7 +64,7 @@ namespace Catch {
return matchedTests;
}
- inline std::size_t listTestsNamesOnly( Config const& config ) {
+ std::size_t listTestsNamesOnly( Config const& config ) {
TestSpec testSpec = config.testSpec();
if( !config.testSpec().hasFilters() )
testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
@@ -81,22 +83,19 @@ namespace Catch {
return matchedTests;
}
- struct TagInfo {
- void add( std::string const& spelling ) {
- ++count;
- spellings.insert( spelling );
- }
- std::string all() const {
- std::string out;
- for( auto const& spelling : spellings )
- out += "[" + spelling + "]";
- return out;
- }
- std::set<std::string> spellings;
- std::size_t count = 0;
- };
+ void TagInfo::add( std::string const& spelling ) {
+ ++count;
+ spellings.insert( spelling );
+ }
- inline std::size_t listTags( Config const& config ) {
+ std::string TagInfo::all() const {
+ std::string out;
+ for( auto const& spelling : spellings )
+ out += "[" + spelling + "]";
+ return out;
+ }
+
+ std::size_t listTags( Config const& config ) {
TestSpec testSpec = config.testSpec();
if( config.testSpec().hasFilters() )
Catch::cout() << "Tags for matching test cases:\n";
@@ -131,7 +130,7 @@ namespace Catch {
return tagCounts.size();
}
- inline std::size_t listReporters( Config const& /*config*/ ) {
+ std::size_t listReporters( Config const& /*config*/ ) {
Catch::cout() << "Available reporters:\n";
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
std::size_t maxNameLen = 0;
@@ -153,7 +152,7 @@ namespace Catch {
return factories.size();
}
- inline Option<std::size_t> list( Config const& config ) {
+ Option<std::size_t> list( Config const& config ) {
Option<std::size_t> listedCount;
if( config.listTests() )
listedCount = listedCount.valueOr(0) + listTests( config );
@@ -167,5 +166,3 @@ namespace Catch {
}
} // end namespace Catch
-
-#endif // TWOBLUECUBES_CATCH_LIST_HPP_INCLUDED
diff --git a/include/internal/catch_list.h b/include/internal/catch_list.h
new file mode 100644
index 00000000..daf158d0
--- /dev/null
+++ b/include/internal/catch_list.h
@@ -0,0 +1,36 @@
+/*
+ * Created by Phil on 5/11/2010.
+ * Copyright 2010 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_LIST_H_INCLUDED
+#define TWOBLUECUBES_CATCH_LIST_H_INCLUDED
+
+#include "catch_option.hpp"
+#include "catch_config.hpp"
+
+namespace Catch {
+
+ std::size_t listTests( Config const& config );
+
+ std::size_t listTestsNamesOnly( Config const& config );
+
+ struct TagInfo {
+ void add( std::string const& spelling );
+ std::string all() const;
+
+ std::set<std::string> spellings;
+ std::size_t count = 0;
+ };
+
+ std::size_t listTags( Config const& config );
+
+ std::size_t listReporters( Config const& /*config*/ );
+
+ Option<std::size_t> list( Config const& config );
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_LIST_H_INCLUDED
diff --git a/include/internal/catch_registry_hub.cpp b/include/internal/catch_registry_hub.cpp
index 9f901085..71967f58 100644
--- a/include/internal/catch_registry_hub.cpp
+++ b/include/internal/catch_registry_hub.cpp
@@ -10,7 +10,7 @@
#include "catch_test_case_registry_impl.hpp"
#include "catch_reporter_registry.hpp"
-#include "catch_exception_translator_registry.hpp"
+#include "catch_exception_translator_registry.h"
#include "catch_tag_alias_registry.h"
#include "catch_startup_exception_registry.h"
diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp
index 25ad3668..9c18e6c5 100644
--- a/include/reporters/catch_reporter_console.cpp
+++ b/include/reporters/catch_reporter_console.cpp
@@ -11,16 +11,13 @@
#include "../internal/catch_reporter_registrars.hpp"
#include "../internal/catch_console_colour.hpp"
#include "../internal/catch_version.h"
-#include "../external/tbc_text_format.h"
+#include "../internal/catch_text.h"
#include <cfloat>
#include <cstdio>
namespace Catch {
- using Tbc::Text;
- using Tbc::TextAttributes;
-
struct ConsoleReporter : StreamingReporterBase {
using StreamingReporterBase::StreamingReporterBase;