Ticket #12540 (closed Feature Requests: fixed)
Provide customisation point for printing types in tests
|Reported by:||Tony Lewis <TonyELewis@…>||Owned by:||renficiaud|
AFAIU (from doc "Logging user defined types"), the current design gives users two options for handling output for their types in tests:
- Provide operator<<
- Prevent printing with BOOST_TEST_DONT_PRINT_LOG_VALUE()
...and all types must be printed.
I suggest that this is to rigid. For some types, users may not want to provide a global operator<<, or they may have already provided an operator<< or they may not own the type.
For these reasons, I think it would be better if Boost Test provided an explicit customization point that defaulted to calling operator<< but that could be overridden by the user to explictly control the Test printing without affecting operator<<.
In fact, I think boost::test_tools::tt_detail::print_log_value is already close to serving this purpose and perhaps it needs little more than being made part of the public interface and documented.
Thanks for all your work.
PS "D4381: Suggested Design for Customization Points" may be relevant here.
- Owner changed from rogeeff to renficiaud
- Status changed from new to assigned
- Milestone changed from To Be Determined to Boost 1.64.0
- Status changed from assigned to closed
- Resolution set to fixed