aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCeleritasCelery <t.macman@gmail.com>2019-02-25 10:32:53 -0800
committerWilfred Hughes <me@wilfred.me.uk>2019-02-28 00:47:34 +0000
commit6312200926f4f674faddd95d8754793236d2571d (patch)
tree1428487b4186d3961a6c5b3be66b436ce9233d3c /test
parent3600547049768657575e643a1d7f41941575d09f (diff)
Remove all advice before determining source of function
Previously, we would only remove the outermost advice. This led to `helpful--primitive-p` returning the wrong answer for primitive functions with more than one active advice. Fixes #185.
Diffstat (limited to 'test')
-rw-r--r--test/helpful-unit-test.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/helpful-unit-test.el b/test/helpful-unit-test.el
index 541639c..008a052 100644
--- a/test/helpful-unit-test.el
+++ b/test/helpful-unit-test.el
@@ -141,6 +141,18 @@ symbol (not a form)."
;; `rename-buffer' is primitive, but it's advised by uniquify.
(should (helpful--primitive-p 'rename-buffer t)))
+(ert-deftest helpful--without-advice ()
+ "Ensure we remove advice to get the underlying function."
+ ;; Removing the advice on an unadvised function should give us the
+ ;; same function.
+ (should
+ (eq (helpful--without-advice #'test-foo)
+ (indirect-function #'test-foo)))
+ ;; Removing the advice should give us an unadvised function.
+ (should
+ (not (helpful--advised-p
+ (helpful--without-advice #'test-foo-advised)))))
+
(ert-deftest helpful-callable ()
;; Functions. Also a regression test for #170.
(helpful-callable 'face-attribute)