From b40fa567a2faf49cc8fc8317065de22c7a409d02 Mon Sep 17 00:00:00 2001 From: mat007 Date: Sat, 12 May 2012 17:37:07 +0000 Subject: [PATCH] Added test for mocking a conversion operator in a template class git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@453 860be788-9bd5-4423-9f1e-828f051e677b --- src/tests/turtle_test/integration_test.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tests/turtle_test/integration_test.cpp b/src/tests/turtle_test/integration_test.cpp index 32c3ff3..4fc2319 100644 --- a/src/tests/turtle_test/integration_test.cpp +++ b/src/tests/turtle_test/integration_test.cpp @@ -187,6 +187,22 @@ BOOST_AUTO_TEST_CASE( mocking_a_template_class_method_is_supported ) BOOST_CHECK( MOCK_VERIFY( m.my_method_t ) ); } +namespace +{ + template< typename T > + struct my_template_converter_mock + { + MOCK_CONVERSION_OPERATOR( T, to_t ) + }; +} + +BOOST_AUTO_TEST_CASE( mocking_a_template_class_conversion_operator_is_supported ) +{ + my_template_converter_mock< int > m; + MOCK_EXPECT( m.to_t ).returns( 42 ); + BOOST_CHECK_EQUAL( 42, m ); +} + namespace { template< typename T >