diff --git a/src/drivers/BoostDriver.cpp b/src/drivers/BoostDriver.cpp index 15f1b006..6fe7d3ae 100644 --- a/src/drivers/BoostDriver.cpp +++ b/src/drivers/BoostDriver.cpp @@ -16,18 +16,16 @@ using ::boost::execution_exception; namespace cucumber { namespace internal { - namespace { - test_case* testCase = 0; - boost::function currentTestBody; +test_case* testCase = 0; +boost::function currentTestBody; - void exec_test_body() { - if (currentTestBody) { - currentTestBody(); - } +void exec_test_body() { + if (currentTestBody) { + currentTestBody(); } - +} bool boost_test_init() { testCase = BOOST_TEST_CASE(&exec_test_body); @@ -37,10 +35,9 @@ bool boost_test_init() { } // Freed by Boost's unit test framework on exit -static CukeBoostLogInterceptor *logInterceptor = 0; - -} +static CukeBoostLogInterceptor* logInterceptor = 0; +} // namespace class CukeBoostLogInterceptor : public ::boost::unit_test::unit_test_log_formatter { public: @@ -48,29 +45,35 @@ class CukeBoostLogInterceptor : public ::boost::unit_test::unit_test_log_formatt void reset(); // Formatter - void log_start( std::ostream&, counter_t /*test_cases_amount*/) {}; - void log_finish( std::ostream&) {}; - void log_build_info( std::ostream&) {}; + void log_start(std::ostream&, counter_t /*test_cases_amount*/){}; + void log_finish(std::ostream&){}; + +#if BOOST_VERSION >= 107000 + void log_build_info(std::ostream&, bool) {} +#else + void log_build_info(std::ostream&){}; +#endif - void test_unit_start( std::ostream&, test_unit const& /*tu*/) {}; - void test_unit_finish( std::ostream&, test_unit const& /*tu*/, unsigned long /*elapsed*/) {}; - void test_unit_skipped( std::ostream&, test_unit const& /*tu*/) {}; + void test_unit_start(std::ostream&, test_unit const& /*tu*/){}; + void test_unit_finish(std::ostream&, test_unit const& /*tu*/, unsigned long /*elapsed*/){}; + void test_unit_skipped(std::ostream&, test_unit const& /*tu*/){}; - void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const&) {}; - void log_exception_finish( std::ostream& ) {}; + void + log_exception_start(std::ostream&, log_checkpoint_data const&, execution_exception const&){}; + void log_exception_finish(std::ostream&){}; - void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types /*let*/) {}; - void log_entry_value( std::ostream&, const_string value); - void log_entry_value( std::ostream&, lazy_ostream const& value); - void log_entry_finish( std::ostream&) {}; + void log_entry_start(std::ostream&, log_entry_data const&, log_entry_types /*let*/){}; + void log_entry_value(std::ostream&, const_string value); + void log_entry_value(std::ostream&, lazy_ostream const& value); + void log_entry_finish(std::ostream&){}; - void entry_context_start( std::ostream&, log_level /*l*/) {} + void entry_context_start(std::ostream&, log_level /*l*/) {} #if BOOST_VERSION >= 106500 - void log_entry_context( std::ostream&, log_level /*l*/, const_string /*value*/) {} - void entry_context_finish( std::ostream&, log_level /*l*/ ) {} + void log_entry_context(std::ostream&, log_level /*l*/, const_string /*value*/) {} + void entry_context_finish(std::ostream&, log_level /*l*/) {} #else - void log_entry_context( std::ostream&, const_string /*value*/) {} - void entry_context_finish( std::ostream& ) {} + void log_entry_context(std::ostream&, const_string /*value*/) {} + void entry_context_finish(std::ostream&) {} #endif private: @@ -113,12 +116,12 @@ const InvokeResult BoostStep::invokeStepBody() { void BoostStep::initBoostTest() { int argc = 1; char dummyArg[] = "dummy"; - char *argv[] = { dummyArg }; + char* argv[] = {dummyArg}; framework::init(&boost_test_init, argc, argv); #if BOOST_VERSION >= 105900 framework::finalize_setup_phase(); #endif - + logInterceptor = new CukeBoostLogInterceptor; ::boost::unit_test::unit_test_log.set_formatter(logInterceptor); ::boost::unit_test::unit_test_log.set_threshold_level(log_all_errors); @@ -126,11 +129,11 @@ void BoostStep::initBoostTest() { void BoostStep::runWithMasterSuite() { currentTestBody = boost::bind(&BoostStep::body, this); - + ::boost::unit_test::framework::run(testCase, false); currentTestBody.clear(); } -} -} +} // namespace internal +} // namespace cucumber