Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] Using boost::exception
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2012-03-06 16:13:18


On Tue, Mar 6, 2012 at 8:53 PM, svarneticist <svarneticist_at_[hidden]> wrote:

> I found it helpful to include this in my test cases:
>
> #include "boost/test/unit_test_monitor.hpp"
> #include "boost/exception/all.hpp"
>
> void translate(boost::exception const& e) {
> BOOST_FAIL(boost::diagnostic_information(e));
> }
>
> struct Exception_fixture {
> Exception_fixture() {
>
>
> ::boost::unit_test::unit_test_monitor.register_exception_translator<boost::exception>(&translate);
> }
> };
>
> BOOST_GLOBAL_FIXTURE( Exception_fixture );
>
> BOOST_AUTO_TEST_CASE( case01 ) {
> //test body
> }
>

Wow!
This is a really great tip! Thanks a lot!



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net