|
Boost Users : |
Subject: Re: [Boost-users] [Test] BOOST_CHECK_EXCEPTION error message still vague
From: Raffi Enficiaud (raffi.enficiaud_at_[hidden])
Date: 2016-02-16 18:00:29
Le 05/02/16 19:06, Merrill Cornish a écrit :
> In BOOST_1_59_0, I complained that the error message from
> BOOST_CHECK_EXCEPTION was indecipherable. In BOOST_1_60_0, things
> improved a lot. But it still leave you hanging.
>
> I use the function fail_msg() as the predicate argument to
> BOOST_CHECK_EXCEPTION. If it finds a specified substring in the
> exception message, it returns true. Otherwise, it returns false. Below
> is an error message from BOOST_CHECK_EXCEPTION when the predicate
> returned false:
>
> exception "std::runtime_error" raised as expected: validation on the
> raised exception through predicate "fail_msg"
>
> The first clause says my code raised the expected exception class. That
> part of the message is clear and unambiguous.
>
> The second clause, however, is a non-sequitur. It seems to only
> acknowledge that there was a predicate named "fail_msg" without saying
> whether it returned true or false. Overall, the whole message doesn't
> say whether BOOST_CHECK_EXCEPTION passed or failed. Since a message was
> output, the user can assume things did not go well, but it seems like
> the message could be more explicit.
>
> Merrill Cornish
Hi,
If I am not mistaken, there should be an "error" in front of this line,
so that the log reads:
some.cpp:34: error: in "test_case_name": exception "std::runtime_error"
raised as expected: validation on the raised exception through predicate
"fail_msg"
which means that the predicate is not passing the test (returning false,
see
http://www.boost.org/doc/libs/1_60_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref/assertion_boost_level_exception.html
).
The same message appears as either a positive or negative, depending on
the log level: if you run the test with --log_level=all you may see
something like:
some.cpp:34: check 'exception "std::runtime_error" raised as expected:
validation on the raised exception through predicate "fail_msg"' has passed
I agree that the message is a bit clumsy, since I am not a native
English speaker, any suggestion is welcome.
Best,
Raffi
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