mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added support for mocking constructors
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@433 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
2768c8b172
commit
d1eed46173
2 changed files with 56 additions and 8 deletions
|
|
@ -275,6 +275,37 @@ BOOST_FIXTURE_TEST_CASE( basic_mock_object_collaboration_usage, fixture )
|
|||
subject.increment();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
MOCK_CLASS( my_constructed_class )
|
||||
{
|
||||
MOCK_CONSTRUCTOR( my_constructed_class, 2, ( int, const std::string& ), constructor )
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( mocking_a_constructor )
|
||||
{
|
||||
MOCK_EXPECT( my_constructed_class::constructor ).with( 42, "some text" ).once();
|
||||
my_constructed_class( 42, "some text" );
|
||||
BOOST_CHECK( MOCK_VERIFY( my_constructed_class::constructor ) );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
template< typename T >
|
||||
MOCK_CLASS( my_constructed_template_class )
|
||||
{
|
||||
MOCK_CONSTRUCTOR_TPL( my_constructed_template_class, 2, ( T, const std::string& ), constructor )
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( mocking_a_template_class_constructor )
|
||||
{
|
||||
MOCK_EXPECT( my_constructed_template_class< int >::constructor ).with( 42, "some text" ).once();
|
||||
my_constructed_template_class< int >( 42, "some text" );
|
||||
BOOST_CHECK( MOCK_VERIFY( my_constructed_template_class< int >::constructor ) );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
MOCK_CLASS( my_destroyed_class )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue