Prevented a crash when mocking a destructor and throwing out of the object scope

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@121 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2010-02-15 22:59:23 +00:00
parent 456869d82b
commit 0e8079d47a
8 changed files with 174 additions and 113 deletions

View file

@ -6,6 +6,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
#define MOCK_USE_BOOST_TEST
#include <turtle/mock.hpp>
#include <boost/mpl/assert.hpp>
@ -204,20 +205,6 @@ BOOST_AUTO_TEST_CASE( mock_functor_is_named )
BOOST_CHECK_EQUAL( "f", to_string( MOCK_MOCKER( f, _ ) ) );
}
namespace
{
MOCK_CLASS( my_destroyed_class )
{
MOCK_DESTRUCTOR( my_destroyed_class, destructor )
};
}
BOOST_AUTO_TEST_CASE( mocking_a_destructor )
{
my_destroyed_class c;
MOCK_EXPECT( c, destructor ).once();
}
BOOST_MPL_ASSERT(( boost::is_same< float, mock::detail::arg< void( float ), 1, 1 >::type > ));
BOOST_MPL_ASSERT(( boost::is_same< float, mock::detail::arg< void( float, int ), 1, 2 >::type > ));
BOOST_MPL_ASSERT(( boost::is_same< int, mock::detail::arg< void( float, int ), 2, 2 >::type > ));