11#include " ../../../include/xtd/tunit/test.hpp"
22#include " ../../../include/xtd/tunit/unit_test.hpp"
33#include < xtd/diagnostics//debug_break>
4+ #include < xtd/runtime/exception_services/exception_dispatch_info>
45#include < xtd/null_pointer_exception>
56#include < exception>
67
78using namespace xtd ;
89using namespace xtd ::diagnostics;
10+ using namespace xtd ::runtime::exception_services;
911using namespace xtd ::tunit;
1012
1113test* test::current_test_ = nullptr ;
@@ -142,16 +144,16 @@ void test::run(const unit_test& unit_test, const test_class& test_class) {
142144 */
143145 } catch (const abort_error&) {
144146 if (!settings::default_settings ().brief ()) unit_test.event_listener_ ->on_test_aborted (test_event_args (*this , test_class, unit_test));
145- } catch (const assert_error&) {
147+ } catch (const ignore_error&) {
148+ if (!settings::default_settings ().brief ()) unit_test.event_listener_ ->on_test_ignored (test_event_args (*this , test_class, unit_test));
149+ } catch (const assert_error& e) {
146150 settings::default_settings ().exit_status (EXIT_FAILURE);
147151 if (settings::default_settings ().brief ()) unit_test.event_listener_ ->on_test_start (test_event_args (*this , test_class, unit_test));
148152 unit_test.event_listener_ ->on_test_failed (test_event_args (*this , test_class, unit_test));
149153 if (settings::default_settings ().break_on_failure ())
150154 debug_break_ ();
151155 if (settings::default_settings ().throw_on_failure ())
152- throw exception {};
153- } catch (const ignore_error&) {
154- if (!settings::default_settings ().brief ()) unit_test.event_listener_ ->on_test_ignored (test_event_args (*this , test_class, unit_test));
156+ exception_dispatch_info::rethrow (e);
155157 } catch (const std::exception& e) {
156158 settings::default_settings ().exit_status (EXIT_FAILURE);
157159 test::current_test ().message_ = " Exception <" + typeof_ (e).full_name () + " > throws" + " (" + e.what () + " )" ;
@@ -161,7 +163,7 @@ void test::run(const unit_test& unit_test, const test_class& test_class) {
161163 if (settings::default_settings ().break_on_failure ())
162164 debug_break_ ();
163165 if (settings::default_settings ().throw_on_failure ())
164- throw exception { };
166+ throw assert_error { test::current_test (). message () };
165167 } catch (...) {
166168 settings::default_settings ().exit_status (EXIT_FAILURE);
167169 test::current_test ().message_ = " Exception <unknown> throws" ;
@@ -171,7 +173,7 @@ void test::run(const unit_test& unit_test, const test_class& test_class) {
171173 if (settings::default_settings ().break_on_failure ())
172174 debug_break_ ();
173175 if (settings::default_settings ().throw_on_failure ())
174- throw exception { };
176+ throw assert_error { test::current_test (). message () };
175177 }
176178
177179 if (!settings::default_settings ().brief ()) unit_test.event_listener_ ->on_test_cleanup_start (test_event_args (*this , test_class, unit_test));
0 commit comments