Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3444: BOOST_CHECK_MESSAGE - 2 problems
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-22 22:33:49
#3444: BOOST_CHECK_MESSAGE - 2 problems
-------------------------------------------------------+--------------------
Reporter: Maxim Yanchenko <Maxim.Yanchenko@â¦> | Owner: rogeeff
Type: Bugs | Status: closed
Milestone: Boost 1.41.0 | Component: test
Version: Boost 1.38.0 | Severity: Problem
Resolution: wontfix | Keywords:
-------------------------------------------------------+--------------------
Changes (by rogeeff):
* status: new => closed
* resolution: => wontfix
Comment:
We can't do what you suggest for 2 reasons:
1. P is not always generate bool, sometimes it's predicate_result.
2. In some cases error message with level all is indeed funny. But I'd
argue that this is very rarely the issue and in most cases this level is
not intended to be human readable. Also in general case we can't be sure
your message is better that what it is now.
As for the solution to your problems I see at least two:
1. Lazy message.
The check description message can be made "lazy". In other words you can
implement structure which perform actual message generation only in the
point when it's requested (operator<<(std::ostream&, YourStruct). I guess
I can implement some kind of helpers for you, but it's unclear yet how
general this problem is. Try this route and let me know if you see
something worth putting in the library.
2. predicate_result
Instead of using BOOST_CHECK_MESSAGE, you cna use BOOST_CHECK and
implement custom predicate function returning predicate_result structure.
You can see more details here:
http://www.boost.org/doc/libs/1_40_0/libs/test/doc/html/utf/testing-tools
/custom-predicate.html
This predicate function can produce different messages in case if check
succeeded or failed.
Let me know if you still having troubles.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3444#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC