Opened 7 years ago

Closed 7 years ago

#11478 closed Bugs (fixed)

Boost Test Exception Assert Failure has poor message

Reported by: merrill.cornish@… Owned by: Raffi Enficiaud
Milestone: Boost 1.60.0 Component: test
Version: Boost 1.59.0 Severity: Problem
Keywords: exception error-message Cc:

Description

Here is the Boost Test assertion:

BOOST_CHECK_EXCEPTION(dummyOpr->setOperand(emptyValue), DiGSE::fail, fail_msg);

Here is the test execution log message:

info: check 'incorrect exception DiGSE::fail is caught' has passed

I have only one exception: DiGSE::fail (derived from std::exception). It is the /only /exception that appears in the BOOST_CHECK_EXCEPTION() assertions. So, what does "incorrect exception DiGSE::fail" mean? If DiGSE::fail was caught, then that part is correct. If the message means that some other exception was caught, then this is a Really Poor way of phrasing that information.

Or, did the predicate return false (which, in my case, means the exception message is wrong)?

But if the wrong exception was caught or the predicate returned false, then why was the assertion declared "has passed"?

Change History (6)

comment:1 by Gennadiy Rozental, 7 years ago

All messages on info level look weird.

You assertion has passed and Boost.Test just trying to notify you about this passed assertion. Part of the statement inside is just assertion description.

What message do you see if assertion fails? Does it make sense?

comment:2 by Raffi Enficiaud, 7 years ago

Owner: changed from Gennadiy Rozental to Raffi Enficiaud

comment:3 by Raffi Enficiaud, 7 years ago

Would you please test revision 4400d54b21533cd070048ffafc1865ce03468d4d (branch tractickets/11478-exception-poor-message). Now logs are printed like this:

../doc/examples/exception_check_predicate.run-fail.cpp:26: info: check 'exception \
   "my_exception" raised as expected: predicate "is_critical" validation on the raised \
   exception' has passed                                                 

or

../doc/examples/exception_api.run-fail.cpp:54: info: check 'exception std::exception \
   raised as expected' has passed

If you have a better/clearer phrasing, please let me know.

Last edited 7 years ago by Raffi Enficiaud (previous) (diff)

comment:4 by Raffi Enficiaud, 7 years ago

Status: newassigned

comment:5 by Raffi Enficiaud, 7 years ago

Milestone: To Be DeterminedBoost 1.60.0

comment:6 by Raffi Enficiaud, 7 years ago

Resolution: fixed
Status: assignedclosed

merged to master

Note: See TracTickets for help on using tickets.