Boost logo

Boost Users :

Subject: Re: [Boost-users] BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES and BOOST_FAIL
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2010-02-27 18:06:51


Rhys Ulerich wrote:
> Is there a way to flag that a Boost.Test auto test case is expected to
> utterly fail per BOOST_FAIL? BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES
> does not seem to handle this use case correctly.

Hmm. Strange. I thought I've replied to this post.

The answer is no. You can only "expect" non-fatal errors

> The question arises because I'm using BOOST_FAIL within an error
> handling callback that I provide to a library. When the library
> issues the callback, all hope is lost and I need to unwind the test
> case to continue sanely.

There is no reason to use fatal error here. Since you can register any
callback you want the easiest solution is to bind result_status variable
to the callback and set it to false if processing failed. Once outside
of the library call if can check the flag value and continue or not
depending on it's value. You can also "expect" that this value is false,
but the further testing is still aborted.

Gennadiy


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