X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fcollection.cc;h=0b2b32492230b3f83c22229291eaeb2fdce1804f;hb=2eb14a59f3626073017de925929dcc7e3e9eb43d;hp=3bf571e8358b14ce4c25a2a4c6a5680eec34b295;hpb=3893029e70c654f4fcf3bf8f8ba5b404afc6d446;p=awesomized%2Flibmemcached diff --git a/libtest/collection.cc b/libtest/collection.cc index 3bf571e8..0b2b3249 100644 --- a/libtest/collection.cc +++ b/libtest/collection.cc @@ -34,10 +34,11 @@ * */ -#include +#include "libtest/yatlcon.h" #include +// @todo possibly have this code fork off so if it fails nothing goes bad static test_return_t runner_code(libtest::Framework* frame, test_st* run, libtest::Timer& _timer) @@ -50,11 +51,14 @@ static test_return_t runner_code(libtest::Framework* frame, try { _timer.reset(); - return_code= frame->runner()->run(run->test_fn, frame->creators_ptr()); + assert(frame); + assert(frame->runner()); + assert(run->test_fn); + return_code= frame->runner()->main(run->test_fn, frame->creators_ptr()); } // Special case where check for the testing of the exception // system. - catch (libtest::fatal &e) + catch (const libtest::fatal& e) { if (libtest::fatal::is_disabled()) { @@ -85,14 +89,14 @@ Collection::Collection(Framework* frame_arg, _skipped(0), _failed(0), _total(0), - _formatter(_name) + _formatter(frame_arg->name(), _name) { fatal_assert(arg); } test_return_t Collection::exec() { - if (test_success(_frame->runner()->pre(_pre, _frame->creators_ptr()))) + if (test_success(_frame->runner()->setup(_pre, _frame->creators_ptr()))) { for (test_st *run= _tests; run->name; run++) { @@ -132,11 +136,11 @@ test_return_t Collection::exec() } libtest::cancel_alarm(); } - catch (libtest::fatal &e) + catch (const libtest::fatal& e) { - stream::cerr(e.file(), e.line(), e.func()) << e.what(); _failed++; formatter()->failed(); + stream::make_cerr(e.file(), e.line(), e.func()) << e.what(); throw; } @@ -158,14 +162,14 @@ test_return_t Collection::exec() break; default: - fatal_message("invalid return code"); + FATAL("invalid return code"); } #if 0 @TODO add code here to allow for a collection to define a method to reset to allow tests to continue. #endif } - (void) _frame->runner()->post(_post, _frame->creators_ptr()); + (void) _frame->runner()->teardown(_post, _frame->creators_ptr()); } if (_failed == 0 and _skipped == 0 and _success)