Currently ON_CALL() and EXPECT_CALL() accepts a
.WithArguments(tuple_matcher) clause for specifying constraints on multiple
arguments, but it's not very easy to use. The proposal:
- Allow optional template arguments to select the function arguments that
will participate in the matching, ala the WithArgs(callable) action.
- Allow the clause to be used more than once in an expectation.
For example,
ON_CALL(foo, Bar(_, _, _))
.WithArguments(A())
.WithArguments<0, 2>(B())
.WithArguments<2, 1>(C());
says that:
- argument 0, 1, and 2 should match matcher A(),
- argument 0 and 2 should match matcher B(), and
- argument 2 and 1 should match matcher C().
One use case is that often a function passes a pointer to a buffer in one
argument and the size of the buffer in another argument, and we may want to
verify that the contents of the buffer are expected.
Original issue reported on code.google.com by shiq...@gmail.com on 2 Oct 2008 at 9:27
Original issue reported on code.google.com by
shiq...@gmail.com
on 2 Oct 2008 at 9:27