Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/CalcQt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ project(CalcQt)

if(TARGET Qt::Core AND TARGET Qt::Gui AND TARGET Qt::Widgets AND TARGET Qt::Test)
add_library(libcalcqt STATIC src/CalculatorWidget.cpp src/CalculatorWidget.h)
target_compile_options(libcalcqt PRIVATE "-Wno-deprecated-declarations")
set_target_properties(libcalcqt PROPERTIES AUTOMOC ON)
target_include_directories(libcalcqt INTERFACE src)
target_link_libraries(libcalcqt
Expand Down
69 changes: 36 additions & 33 deletions src/drivers/BoostDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ using ::boost::execution_exception;
namespace cucumber {
namespace internal {


namespace {

test_case* testCase = 0;
boost::function<void()> currentTestBody;
test_case* testCase = 0;
boost::function<void()> 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);
Expand All @@ -37,40 +35,45 @@ 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:
const InvokeResult getResult() const;
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:
Expand Down Expand Up @@ -113,24 +116,24 @@ 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);
}

void BoostStep::runWithMasterSuite() {
currentTestBody = boost::bind(&BoostStep::body, this);

::boost::unit_test::framework::run(testCase, false);

currentTestBody.clear();
}

}
}
} // namespace internal
} // namespace cucumber