Opened 9 years ago

Closed 7 years ago

#9390 closed Bugs (fixed)

Incomplete BOOST_TEST_DONT_PRINT_LOG_VALUE

Reported by: Marek Kurdej <curdeius@…> Owned by: Raffi Enficiaud
Milestone: Boost 1.59.0 Component: test
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc: curdeius@…

Description

When we use a user-defined error without overloaded operator<<(std::ostream&, T const&), we have to use BOOST_TEST_DONT_PRINT_LOG_VALUE in order to prevent UTF to print output to log.

BOOST_TEST_DONT_PRINT_LOG_VALUE works correctly only if you use macros like BOOST_CHECK_EQUAL.

However, BOOST_CHECK_EQUAL_COLLECTIONS provokes compile-time error. For instance, on MSVC2010 (Windows x64), the error message is:

compile-time error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const MyClass' (or there is no acceptable conversion)	c:\lib\Boost\include\boost-1_54\boost\test\utils\wrap_stringstream.hpp	66
}}}.

The problem is that ```BOOST_CHECK_EQUAL_COLLECTIONS`` uses ```operator<<( basic_wrap_stringstream<CharT>& targ, T const& t )``` from wrap_stringstream.hpp, whereas BOOST_CHECK_EQUAL uses ```print_log_value::operator()( std::ostream& ostr, T const& t )``` from test_tools.hpp.

BOOST_TEST_DONT_PRINT_LOG_VALUE only specializes the latter.

The solution is to partially specialize the former template as well.

Attachments (2)

boost_test_dont_print_log-collections.cpp (772 bytes ) - added by Marek Kurdej <curdeius@…> 9 years ago.
Sample program which reveals the problem.
boost_test_dont_print_log-collections.patch (1.9 KB ) - added by Marek Kurdej <curdeius@…> 9 years ago.
Proposed patch.

Download all attachments as: .zip

Change History (6)

by Marek Kurdej <curdeius@…>, 9 years ago

Sample program which reveals the problem.

by Marek Kurdej <curdeius@…>, 9 years ago

Proposed patch.

comment:1 by Marek Kurdej <curdeius@…>, 9 years ago

Cc: curdeius@… added
Component: Nonetest
Milestone: To Be DeterminedBoost 1.56.0
Owner: set to Gennadiy Rozental

comment:2 by Raffi Enficiaud, 8 years ago

Owner: changed from Gennadiy Rozental to Raffi Enficiaud
Status: newassigned

comment:3 by Raffi Enficiaud, 8 years ago

Fixed in develop

comment:4 by Raffi Enficiaud, 7 years ago

Milestone: Boost 1.56.0Boost 1.59.0
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.