diff options
| author | Stefan Monnier | 2013-08-04 16:18:11 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-08-04 16:18:11 -0400 |
| commit | 671d5c16547d16bef2efa056705bd35b5feacc29 (patch) | |
| tree | 4bc2c3774ce9914f21508d0e2a83e25504dbc1db /test | |
| parent | e443729d658ee2b9e0f55bbbb90241819bf516a6 (diff) | |
| download | emacs-671d5c16547d16bef2efa056705bd35b5feacc29.tar.gz emacs-671d5c16547d16bef2efa056705bd35b5feacc29.zip | |
* lisp/subr.el (macrop): New function.
(text-clone--maintaining): New var.
(text-clone--maintain): Rename from text-clone-maintain. Use it
instead of inhibit-modification-hooks.
* lisp/emacs-lisp/nadvice.el (advice--normalize): For aliases to macros, use
a proxy, so as handle autoloads and redefinitions of the target.
(advice--defalias-fset, advice-remove): Use advice--symbol-function.
* lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
Remove bogus (arrayp . stringp) pair. Add entries for `vectorp'.
(pcase--mutually-exclusive-p): New function.
(pcase--split-consp): Use it.
(pcase--split-pred): Use it. Optimize the case where `pat' is a qpat
mutually exclusive with the current predicate.
* test/automated/advice-tests.el (advice-tests-nadvice): Test removal
before definition.
(advice-tests-macroaliases): New test.
* lisp/emacs-lisp/edebug.el (edebug-lookup-function): Remove function.
(edebug-macrop): Remove. Use `macrop' instead.
* lisp/emacs-lisp/advice.el (ad-subr-p): Remove. Use `subrp' instead.
(ad-macro-p):
* lisp/eshell/esh-cmd.el (eshell-macrop):
* lisp/apropos.el (apropos-macrop): Remove. Use `macrop' instead.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 6 | ||||
| -rw-r--r-- | test/automated/advice-tests.el | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 32fc077459b..d744a5c788d 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-08-04 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * automated/advice-tests.el (advice-tests-nadvice): Test removal | ||
| 4 | before definition. | ||
| 5 | (advice-tests-macroaliases): New test. | ||
| 6 | |||
| 1 | 2013-08-04 Glenn Morris <rgm@gnu.org> | 7 | 2013-08-04 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * automated/ert-tests.el: Disable failing test that no-one seems | 9 | * automated/ert-tests.el: Disable failing test that no-one seems |
diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el index 69c15e34ed0..424f447ae4b 100644 --- a/test/automated/advice-tests.el +++ b/test/automated/advice-tests.el | |||
| @@ -25,7 +25,12 @@ | |||
| 25 | 25 | ||
| 26 | (ert-deftest advice-tests-nadvice () | 26 | (ert-deftest advice-tests-nadvice () |
| 27 | "Test nadvice code." | 27 | "Test nadvice code." |
| 28 | (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5))) | ||
| 29 | (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 2))) | ||
| 30 | (advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 5))) | ||
| 28 | (defun sm-test1 (x) (+ x 4)) | 31 | (defun sm-test1 (x) (+ x 4)) |
| 32 | (should (equal (sm-test1 6) 20)) | ||
| 33 | (advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 2))) | ||
| 29 | (should (equal (sm-test1 6) 10)) | 34 | (should (equal (sm-test1 6) 10)) |
| 30 | (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5))) | 35 | (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5))) |
| 31 | (should (equal (sm-test1 6) 50)) | 36 | (should (equal (sm-test1 6) 50)) |
| @@ -42,6 +47,18 @@ | |||
| 42 | (defmacro sm-test3 (x) `(call-test3 ,x)) | 47 | (defmacro sm-test3 (x) `(call-test3 ,x)) |
| 43 | (should (equal (macroexpand '(sm-test3 56)) '(toto (call-test3 56))))) | 48 | (should (equal (macroexpand '(sm-test3 56)) '(toto (call-test3 56))))) |
| 44 | 49 | ||
| 50 | (ert-deftest advice-tests-macroaliases () | ||
| 51 | "Test nadvice code on aliases to macros." | ||
| 52 | (defmacro sm-test1 (a) `(list ',a)) | ||
| 53 | (defalias 'sm-test1-alias 'sm-test1) | ||
| 54 | (should (equal (macroexpand '(sm-test1-alias 5)) '(list '5))) | ||
| 55 | (advice-add 'sm-test1-alias :around | ||
| 56 | (lambda (f &rest args) `(cons 1 ,(apply f args)))) | ||
| 57 | (should (equal (macroexpand '(sm-test1-alias 5)) '(cons 1 (list '5)))) | ||
| 58 | (defmacro sm-test1 (a) `(list 0 ',a)) | ||
| 59 | (should (equal (macroexpand '(sm-test1-alias 5)) '(cons 1 (list 0 '5))))) | ||
| 60 | |||
| 61 | |||
| 45 | (ert-deftest advice-tests-advice () | 62 | (ert-deftest advice-tests-advice () |
| 46 | "Test advice code." | 63 | "Test advice code." |
| 47 | (defun sm-test2 (x) (+ x 4)) | 64 | (defun sm-test2 (x) (+ x 4)) |