mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Fixed a bug preventing non-const pointer to be logged properly
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@304 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
103eed82cb
commit
5ad7562d65
3 changed files with 43 additions and 7 deletions
|
|
@ -105,11 +105,7 @@ namespace detail3
|
|||
}
|
||||
|
||||
template< typename T >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if<
|
||||
boost::function_types::is_callable_builtin< T >,
|
||||
stream&
|
||||
>::type
|
||||
operator<<( stream& s, const T& t )
|
||||
stream& operator<<( stream& s, const T& t )
|
||||
{
|
||||
using namespace detail3;
|
||||
*s.s_ << t;
|
||||
|
|
@ -257,10 +253,20 @@ namespace detail
|
|||
boost::function_types::is_callable_builtin< T >,
|
||||
stream&
|
||||
>::type
|
||||
operator<<( stream& s, const T& )
|
||||
operator<<( stream& s, T* )
|
||||
{
|
||||
return s << '?';
|
||||
}
|
||||
template< typename T >
|
||||
BOOST_DEDUCED_TYPENAME boost::disable_if<
|
||||
boost::function_types::is_callable_builtin< T >,
|
||||
stream&
|
||||
>::type
|
||||
operator<<( stream& s, T* t )
|
||||
{
|
||||
*s.s_ << t;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // #ifndef MOCK_LOG_HPP_INCLUDED
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#define MOCK_USE_CONVERSIONS
|
||||
#include <turtle/log.hpp>
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
|
|
@ -30,6 +31,20 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( pointer_yields_its_value_when_serialized_with_conversions )
|
||||
{
|
||||
{
|
||||
int i = 0;
|
||||
BOOST_CHECK_NE( "?", to_string( &i ) );
|
||||
BOOST_CHECK_EQUAL( boost::lexical_cast< std::string >( &i ), to_string( &i ) );
|
||||
}
|
||||
{
|
||||
const int i = 0;
|
||||
BOOST_CHECK_NE( "?", to_string( &i ) );
|
||||
BOOST_CHECK_EQUAL( boost::lexical_cast< std::string >( &i ), to_string( &i ) );
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( base_type_yields_its_value_when_serialized_with_conversions )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( "42", to_string( 42 ) );
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <turtle/log.hpp>
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
|
|
@ -29,6 +30,20 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( pointer_yields_its_value_when_serialized_without_conversions )
|
||||
{
|
||||
{
|
||||
int i = 0;
|
||||
BOOST_CHECK_NE( "?", to_string( &i ) );
|
||||
BOOST_CHECK_EQUAL( boost::lexical_cast< std::string >( &i ), to_string( &i ) );
|
||||
}
|
||||
{
|
||||
const int i = 0;
|
||||
BOOST_CHECK_NE( "?", to_string( &i ) );
|
||||
BOOST_CHECK_EQUAL( boost::lexical_cast< std::string >( &i ), to_string( &i ) );
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( base_type_yields_its_value_when_serialized_without_conversions )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( "42", to_string( 42 ) );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue