Boost logo

Boost Users :

Subject: [Boost-users] [Test] BOOST_CHECK_EXCEPTION error message still vague
From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2016-02-05 13:06:18


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


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