Closed GoogleCodeExporter closed 9 years ago
One idea to implement this would be to have mechanism similar to boost function:
Tester t;
MyMock m;
Action<void (bool)> a = testing::Bind(&t, &Tester::myAction, _1, 7);
EXPECT_CALL(m, mockMethod(_)).WillOnce(a);
Original comment by prez...@gmail.com
on 18 Feb 2010 at 12:01
So why not
Tester t;
MyMock m;
EXPECT_CALL(m, mockMethod(_))
.WillOnce(testing::Invoke(boost::bind(&Tester::myAction, &t, _1, 7)));
?
Original comment by vladlosev
on 19 Feb 2010 at 1:13
Write this once:
ACTION_P2(DoMyAction, tester, n) { return tester->myAction(arg0, n); }
Then you can use it many times, with a more readable syntax:
...WillOnce(DoMyAction(&t, 7));
We *could* define Bind() for actions, but I'm not sure how often it's needed,
and I
don't want to reinvent tr1 bind given that it will be part of the STL soonish.
Original comment by w...@google.com
on 19 Feb 2010 at 7:10
We don't intend to reinvent bind.
Original comment by w...@google.com
on 6 Mar 2010 at 5:42
Original issue reported on code.google.com by
prez...@gmail.com
on 18 Feb 2010 at 11:54