branch: scratch/el-mock commit e65ec012a724d0f2518e6601279a07e34716cc45 Author: Philipp Stephani <p...@google.com> Commit: Philipp Stephani <p...@google.com>
Document that and when arguments and return values are evaluated --- el-mock.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/el-mock.el b/el-mock.el index 812cc12c3f..136d067df8 100644 --- a/el-mock.el +++ b/el-mock.el @@ -195,6 +195,7 @@ Synopsis: * (stub FUNCTION => RETURN-VALUE) Create a FUNCTION stub which returns RETURN-VALUE. +RETURN-VALUE is evaluated when executing the mocked function. Example: (with-mock @@ -231,6 +232,11 @@ Synopsis: Wildcard: The `*' is a special symbol: it accepts any value for that argument position. +ARGS that are not `*' are evaluated when the mock is verified, +i.e. upon leaving the enclosing `with-mock' form. ARGS are +evaluated using dynamic scoping. The RETURN-VALUE is evaluated +when executing the mocked function. + Example: (with-mock (mock (f * 2) => 3) @@ -307,6 +313,11 @@ Spec is arguments of `mock', `not-called' or `stub'. * (FUNCTION => RETURN-VALUE) ; stub which returns RETURN-VALUE * (FUNCTION not-called) ; not-called FUNCTION +ARGS that are not `*' are evaluated when the mock is verified, +i.e. upon leaving the enclosing `with-mock' form. ARGS are +evaluated using dynamic scoping. The RETURN-VALUE is evaluated +when executing the mocked function. + Example: (mocklet (((mock-nil 1)) ((mock-1 *) => 1)