IStreamingReporter is now the default. Use REGISTER_LEGACY_REPORTER to register… you guessed it: legacy reporters

The built-in reporters are still legacy at the moment.
This commit is contained in:
Phil Nash 2012-11-30 19:29:03 +00:00
parent 4e12e12c1f
commit 8255acf88f
4 changed files with 19 additions and 6 deletions

View File

@ -84,6 +84,7 @@
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
#define CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
#define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
@ -126,6 +127,7 @@
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
#define REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
#define GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )

View File

@ -76,9 +76,9 @@ namespace Catch {
void Config::dummy() {}
INTERNAL_CATCH_REGISTER_REPORTER( "basic", BasicReporter )
INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "basic", BasicReporter )
INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "xml", XmlReporter )
INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "junit", JunitReporter )
}

View File

@ -38,6 +38,17 @@ namespace Catch {
class ReporterFactory : public IReporterFactory {
// *** Please Note ***:
// - If you end up here looking at a compiler error because it's trying to register
// your custom reporter class be aware that the native reporter interface has changed
// to IStreamingReporter. The "legacy" interface, IReporter, is still supported via
// an adapter. Just use REGISTER_LEGACY_REPORTER to take advantage of the adapter.
// However please consider updating to the new interface as the old one is now
// deprecated and will probably be removed quite soon!
// Please contact me via github if you have any questions at all about this.
// In fact, ideally, please contact me anyway to let me know you've hit this - as I have
// no idea who is actually using custom reporters at all (possibly no-one!).
// The new interface is designed to minimise exposure to interface changes in the future.
virtual IStreamingReporter* create( const ReporterConfig& config ) const {
return new T( config );
}
@ -55,9 +66,9 @@ namespace Catch {
};
}
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
#define INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) \
Catch::LegacyReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
#define INTERNAL_CATCH_REGISTER_REPORTER2( name, reporterType ) \
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED

View File

@ -106,6 +106,6 @@ namespace Catch{
const std::string MockReporter::recordTestCases = "[tc]";
const std::string MockReporter::recordSections =" [s]";
INTERNAL_CATCH_REGISTER_REPORTER( "mock", MockReporter )
INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "mock", MockReporter )
}