Tags beginning with a non alpha-numeric character are now disallowed.

Added !throws special tag which denotes a test case to be skipped when run with -e
(the idea being that the test case is expected to throw an exception which is not caught within a XXX_THROWS assertion).
This commit is contained in:
Phil Nash 2014-04-15 18:44:37 +01:00
parent c5406a25bf
commit 20cad7cb1d
18 changed files with 312 additions and 244 deletions

View file

@ -73,7 +73,10 @@ namespace {
return true;
}
Win32ColourImpl platformColourImpl;
static Detail::IColourImpl* platformColourInstance() {
static Win32ColourImpl s_instance;
return &s_instance;
}
} // end anon namespace
} // end namespace Catch
@ -120,7 +123,10 @@ namespace {
return isatty(STDOUT_FILENO);
}
PosixColourImpl platformColourImpl;
static Detail::IColourImpl* platformColourInstance() {
static PosixColourImpl s_instance;
return &s_instance;
}
} // end anon namespace
} // end namespace Catch
@ -132,21 +138,28 @@ namespace Catch {
namespace {
struct NoColourImpl : Detail::IColourImpl {
void use( Colour::Code ) {}
static IColourImpl* instance() {
static NoColourImpl s_instance;
return &s_instance;
}
};
NoColourImpl noColourImpl;
static const bool shouldUseColour = shouldUseColourForPlatform() &&
!isDebuggerActive();
static bool shouldUseColour() {
return shouldUseColourForPlatform() && !isDebuggerActive();
}
}
Colour::Colour( Code _colourCode ){ use( _colourCode ); }
Colour::~Colour(){ use( None ); }
void Colour::use( Code _colourCode ) {
impl->use( _colourCode );
impl()->use( _colourCode );
}
Detail::IColourImpl* Colour::impl = shouldUseColour
? static_cast<Detail::IColourImpl*>( &platformColourImpl )
: static_cast<Detail::IColourImpl*>( &noColourImpl );
Detail::IColourImpl* Colour::impl() {
return shouldUseColour()
? platformColourInstance()
: NoColourImpl::instance();
}
} // end namespace Catch