branch: externals/assess commit 29e80b7540edb1a570b43a3b39b3e0643a9d56b5 Author: Phillip Lord <phillip.l...@russet.org.uk> Commit: Phillip Lord <phillip.l...@russet.org.uk>
Ensure capture function returns correct value Previously, assess-call-capture was forcing the return of internal data structures from the captured function. It now does not affect the return value at all. --- assess-call.el | 3 ++- test/assess-call-test.el | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/assess-call.el b/assess-call.el index dc30978852..78d61740a7 100644 --- a/assess-call.el +++ b/assess-call.el @@ -63,7 +63,8 @@ values of FN are returned instead." (let ((rtn (apply fn args))) (setq capture-store (cons (cons args rtn) - capture-store))))))) + capture-store)) + rtn))))) (defun assess-call-capture (sym-fn fn) "Trace all calls to SYM-FN when FN is called with no args. diff --git a/test/assess-call-test.el b/test/assess-call-test.el index 46e9cf953e..66da692039 100644 --- a/test/assess-call-test.el +++ b/test/assess-call-test.el @@ -137,5 +137,23 @@ (assess-deliberate-error (not assess-call-test-hook))))) + +(ert-deftest assess-call-return-value () + "Test that return of the instrumented form is not affected. + +The form that we are capturing should return the same value that +it would were it not instrumented, which was not true with +earlier versions of this library." + (should + (= 4 + (let ((rtn-from-form)) + (assess-call-capture + #'assess-call-capture-multiply + (lambda () + (setq rtn-from-form + (assess-call-capture-multiply 2 2)))) + rtn-from-form)))) + + (provide 'assess-call-test) ;;; assess-call-test ends here