branch: elpa/with-simulated-input
commit 26fc928f4207fbf304f824b99fdc27dd7e9e8fcd
Author: Ryan C. Thompson <[email protected]>
Commit: Ryan C. Thompson <[email protected]>

    Work around an incompatibility in Emacs 24 in tests
---
 tests/test-unload.el | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/tests/test-unload.el b/tests/test-unload.el
index fd3302944e..423b1d4671 100644
--- a/tests/test-unload.el
+++ b/tests/test-unload.el
@@ -6,15 +6,19 @@
 
 (defun has-advice (symbol advice)
   (let ((advice-fun-to-find
-         (indirect-function advice))
+         ;; In Emacs 24, `indirect-function' throws an error instead
+         ;; of returning nil for void functions. We want it to return nil.
+         (ignore-errors (indirect-function advice)))
         (found nil))
-    (advice-mapc
-     (lambda (ad-fun ad-props)
-       (setq found
-             (or found
-                 (equal (indirect-function ad-fun)
-                        advice-fun-to-find))))
-     symbol)
+    (when advice-fun-to-find
+      (advice-mapc
+       (lambda (ad-fun ad-props)
+         (let ((ad-fun-def (ignore-errors (indirect-function ad-fun))))
+           (when ad-fun-def
+             (setq found
+                   (or found
+                       (equal ad-fun-def advice-fun-to-find))))))
+       symbol))
     found))
 
 (describe "The `with-simulated-input' library"

Reply via email to