mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Moved ofstream back out to Main - to address #112
This commit is contained in:
parent
d5fbe2ec5d
commit
a760772f77
@ -8,10 +8,6 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
||||||
|
|
||||||
#include "reporters/catch_reporter_basic.hpp"
|
|
||||||
#include "reporters/catch_reporter_xml.hpp"
|
|
||||||
#include "reporters/catch_reporter_junit.hpp"
|
|
||||||
|
|
||||||
#include "internal/catch_commandline.hpp"
|
#include "internal/catch_commandline.hpp"
|
||||||
#include "internal/catch_list.hpp"
|
#include "internal/catch_list.hpp"
|
||||||
#include "internal/catch_runner_impl.hpp"
|
#include "internal/catch_runner_impl.hpp"
|
||||||
@ -22,11 +18,7 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
INTERNAL_CATCH_REGISTER_REPORTER( "basic", BasicReporter )
|
inline int resolveStream( std::ofstream& ofs, Config& configWrapper ) {
|
||||||
INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
|
|
||||||
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
|
||||||
|
|
||||||
inline int resolveStream( Config& configWrapper ) {
|
|
||||||
const ConfigData& config = configWrapper.data();
|
const ConfigData& config = configWrapper.data();
|
||||||
|
|
||||||
if( !config.stream.empty() ) {
|
if( !config.stream.empty() ) {
|
||||||
@ -36,7 +28,6 @@ namespace Catch {
|
|||||||
configWrapper.setFilename( config.stream );
|
configWrapper.setFilename( config.stream );
|
||||||
}
|
}
|
||||||
// Open output file, if specified
|
// Open output file, if specified
|
||||||
std::ofstream ofs;
|
|
||||||
if( !config.outputFilename.empty() ) {
|
if( !config.outputFilename.empty() ) {
|
||||||
ofs.open( config.outputFilename.c_str() );
|
ofs.open( config.outputFilename.c_str() );
|
||||||
if( ofs.fail() ) {
|
if( ofs.fail() ) {
|
||||||
@ -65,7 +56,8 @@ namespace Catch {
|
|||||||
|
|
||||||
inline int Main( Config& configWrapper ) {
|
inline int Main( Config& configWrapper ) {
|
||||||
|
|
||||||
int result = resolveStream( configWrapper );
|
std::ofstream ofs;
|
||||||
|
int result = resolveStream( ofs, configWrapper );
|
||||||
if( result != 0 )
|
if( result != 0 )
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user