mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Replaced std::type_info with boost::detail::sp_typeinfo
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@553 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
8aa007af3b
commit
25ccf6078f
4 changed files with 11 additions and 9 deletions
|
|
@ -17,7 +17,7 @@ namespace
|
||||||
template< typename T >
|
template< typename T >
|
||||||
std::string to_string( const T& )
|
std::string to_string( const T& )
|
||||||
{
|
{
|
||||||
return boost::lexical_cast< std::string >( mock::detail::type_name( typeid( T ) ) );
|
return boost::lexical_cast< std::string >( mock::detail::type_name( BOOST_SP_TYPEID( T ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,5 +75,5 @@ BOOST_AUTO_TEST_CASE( name_of_type_from_unnamed_inner_namespace_is_extracted )
|
||||||
BOOST_AUTO_TEST_CASE( name_of_local_type_is_extracted )
|
BOOST_AUTO_TEST_CASE( name_of_local_type_is_extracted )
|
||||||
{
|
{
|
||||||
struct my_local_type {};
|
struct my_local_type {};
|
||||||
BOOST_CHECK_EQUAL( "my_local_type", boost::lexical_cast< std::string >( mock::detail::type_name( typeid( my_local_type ) ) ) );
|
BOOST_CHECK_EQUAL( "my_local_type", boost::lexical_cast< std::string >( mock::detail::type_name( BOOST_SP_TYPEID( my_local_type ) ) ) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace
|
||||||
{
|
{
|
||||||
fixture()
|
fixture()
|
||||||
{
|
{
|
||||||
mock::detail::configure( o, e, "instance", mock::detail::type_name( typeid( o ) ), "name" );
|
mock::detail::configure( o, e, "instance", mock::detail::type_name( BOOST_SP_TYPEID( o ) ), "name" );
|
||||||
}
|
}
|
||||||
object o;
|
object o;
|
||||||
mock::detail::function< void() > e;
|
mock::detail::function< void() > e;
|
||||||
|
|
@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE( an_object_is_assignable_by_sharing_its_state )
|
||||||
mock::detail::function< void() > e;
|
mock::detail::function< void() > e;
|
||||||
{
|
{
|
||||||
object o2;
|
object o2;
|
||||||
mock::detail::configure( o2, e, "instance", mock::detail::type_name( typeid( o2 ) ), "name" );
|
mock::detail::configure( o2, e, "instance", mock::detail::type_name( BOOST_SP_TYPEID( o2 ) ), "name" );
|
||||||
e.expect().once();
|
e.expect().once();
|
||||||
o1 = o2;
|
o1 = o2;
|
||||||
BOOST_CHECK( ! mock::verify( o2 ) );
|
BOOST_CHECK( ! mock::verify( o2 ) );
|
||||||
|
|
@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE( an_object_is_copiable_by_sharing_its_state )
|
||||||
std::auto_ptr< object > o2( new object );
|
std::auto_ptr< object > o2( new object );
|
||||||
const object o1( *o2 );
|
const object o1( *o2 );
|
||||||
mock::detail::function< void() > e;
|
mock::detail::function< void() > e;
|
||||||
mock::detail::configure( *o2, e, "instance", mock::detail::type_name( typeid( *o2 ) ), "name" );
|
mock::detail::configure( *o2, e, "instance", mock::detail::type_name( BOOST_SP_TYPEID( *o2 ) ), "name" );
|
||||||
e.expect().once();
|
e.expect().once();
|
||||||
BOOST_CHECK( ! mock::verify( *o2 ) );
|
BOOST_CHECK( ! mock::verify( *o2 ) );
|
||||||
BOOST_CHECK( ! mock::verify( o1 ) );
|
BOOST_CHECK( ! mock::verify( o1 ) );
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#define MOCK_TYPE_NAME_HPP_INCLUDED
|
#define MOCK_TYPE_NAME_HPP_INCLUDED
|
||||||
|
|
||||||
#include <boost/test/utils/basic_cstring/io.hpp>
|
#include <boost/test/utils/basic_cstring/io.hpp>
|
||||||
|
#include <boost/detail/sp_typeinfo.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
@ -25,7 +26,7 @@ namespace detail
|
||||||
class type_name
|
class type_name
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit type_name( const std::type_info& info )
|
explicit type_name( const boost::detail::sp_typeinfo& info )
|
||||||
: info_( &info )
|
: info_( &info )
|
||||||
{}
|
{}
|
||||||
friend std::ostream& operator<<( std::ostream& s, const type_name& t )
|
friend std::ostream& operator<<( std::ostream& s, const type_name& t )
|
||||||
|
|
@ -34,7 +35,8 @@ namespace detail
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void serialize( std::ostream& s, const std::type_info& info ) const
|
void serialize( std::ostream& s,
|
||||||
|
const boost::detail::sp_typeinfo& info ) const
|
||||||
{
|
{
|
||||||
const char* name = info.name();
|
const char* name = info.name();
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
@ -76,7 +78,7 @@ namespace detail
|
||||||
s << name;
|
s << name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::type_info* info_;
|
const boost::detail::sp_typeinfo* info_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} // mock
|
} // mock
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
{ \
|
{ \
|
||||||
mock::detail::configure( *this, t##_mock_, \
|
mock::detail::configure( *this, t##_mock_, \
|
||||||
instance.substr( 0, instance.rfind( BOOST_PP_STRINGIZE(t) ) ), \
|
instance.substr( 0, instance.rfind( BOOST_PP_STRINGIZE(t) ) ), \
|
||||||
mock::detail::type_name( typeid( *this ) ), \
|
mock::detail::type_name( BOOST_SP_TYPEID( *this ) ), \
|
||||||
BOOST_PP_STRINGIZE(t) ); \
|
BOOST_PP_STRINGIZE(t) ); \
|
||||||
return t##_mock_; \
|
return t##_mock_; \
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue