Suppress MSVC error dialogs and add test for report_errors()

This commit is contained in:
Glen Fernandes
2018-09-04 20:28:30 -04:00
parent f2638b6d64
commit 76c3538315
3 changed files with 21 additions and 2 deletions

View File

@ -46,11 +46,15 @@ class test_result {
public:
test_result()
: report_(false)
, errors_(0) { }
, errors_(0) {
#ifdef BOOST_MSVC
::_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
}
~test_result() {
if (!report_) {
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "report_errors() not called" << std::endl;
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "main() should return report_errors()" << std::endl;
std::abort();
}
}

View File

@ -89,6 +89,7 @@ run-fail lightweight_test_fail8.cpp ;
run-fail lightweight_test_fail8.cpp : : : <rtti>off : lightweight_test_fail8_no_rtti ;
run-fail lightweight_test_fail9.cpp ;
run-fail lightweight_test_fail10.cpp ;
run-fail lightweight_test_fail11.cpp ;
run-fail lightweight_test_lt_fail.cpp ;
run-fail lightweight_test_le_fail.cpp ;
run-fail lightweight_test_gt_fail.cpp ;

View File

@ -0,0 +1,14 @@
/*
Copyright 2018 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/core/lightweight_test.hpp>
int main()
{
BOOST_TEST(true);
return 0;
}