Fixed alternate stream bugs

This commit is contained in:
Phil Nash
2012-09-26 18:36:58 +01:00
parent 60fb60f5e0
commit c4160e9ef8
5 changed files with 43 additions and 22 deletions

View File

@@ -92,10 +92,10 @@ namespace Catch {
return getCurrentMutableContext();
}
std::streambuf* createStreamBuf( const std::string& streamName ) {
if( streamName == "stdout" ) return std::cout.rdbuf();
if( streamName == "stderr" ) return std::cerr.rdbuf();
if( streamName == "debug" ) return new StreamBufImpl<OutputDebugWriter>;
Stream createStream( const std::string& streamName ) {
if( streamName == "stdout" ) return Stream( std::cout.rdbuf(), false );
if( streamName == "stderr" ) return Stream( std::cerr.rdbuf(), false );
if( streamName == "debug" ) return Stream( new StreamBufImpl<OutputDebugWriter>, true );
throw std::domain_error( "Unknown stream: " + streamName );
}