Added support for C++11 lambdas as constraints

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@620 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2013-04-11 16:24:26 +00:00
parent c5861a744d
commit 4afe1d32d4
6 changed files with 77 additions and 10 deletions

View file

@ -261,4 +261,10 @@ This is actually a bug in the compiler, for more information see [@http://connec
[endsect]
[section Using C++11 lambda as constraints requires decltype compiler support]
The technique used in order to detect whether a constraint is a C++11 lambda or not is based on decltype, which means the library can fail to detect a lambda in case the compiler does not support it.
[endsect]
[endsect]

View file

@ -590,6 +590,14 @@ Example using [@http://www.boost.org/libs/phoenix Boost.Phoenix] :
MOCK_EXPECT( c.method ).with( boost::phoenix::arg_names::_1 == 42 );
}
Example using C++11 lambdas :
BOOST_AUTO_TEST_CASE( demonstrates_adding_a_constraint_with_cxx11_lambda )
{
mock_class c;
MOCK_EXPECT( c.method ).with( []( int actual ) { return 42 == actual; } );
}
Example using &&, || and ! :
BOOST_AUTO_TEST_CASE( demonstrates_combining_constraints )