diff options
| author | Basil L. Contovounesios | 2023-08-06 20:10:16 +0200 |
|---|---|---|
| committer | Basil L. Contovounesios | 2023-08-06 20:10:16 +0200 |
| commit | 4a973ed2bfb1da91a457a49a3a4089589fdf2d5f (patch) | |
| tree | f6e3e1ed3ac09442c1e81c0996cd76122efe9295 /test/lisp | |
| parent | 1cc20535f8730f49cd5d012313c1eaf0627d7216 (diff) | |
| download | emacs-4a973ed2bfb1da91a457a49a3a4089589fdf2d5f.tar.gz emacs-4a973ed2bfb1da91a457a49a3a4089589fdf2d5f.zip | |
; Pacify new nadvice-tests byte-compiler warnings.
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/emacs-lisp/nadvice-tests.el | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/test/lisp/emacs-lisp/nadvice-tests.el b/test/lisp/emacs-lisp/nadvice-tests.el index f6bd5733ba3..7dfa936214a 100644 --- a/test/lisp/emacs-lisp/nadvice-tests.el +++ b/test/lisp/emacs-lisp/nadvice-tests.el | |||
| @@ -65,8 +65,9 @@ | |||
| 65 | (defun sm-test2 (x) (+ x 4)) | 65 | (defun sm-test2 (x) (+ x 4)) |
| 66 | (declare-function sm-test2 nil) | 66 | (declare-function sm-test2 nil) |
| 67 | (should (equal (sm-test2 6) 10)) | 67 | (should (equal (sm-test2 6) 10)) |
| 68 | (defadvice sm-test2 (around sm-test activate) | 68 | (with-suppressed-warnings ((obsolete defadvice)) |
| 69 | ad-do-it (setq ad-return-value (* ad-return-value 5))) | 69 | (defadvice sm-test2 (around sm-test activate) |
| 70 | ad-do-it (setq ad-return-value (* ad-return-value 5)))) | ||
| 70 | (should (equal (sm-test2 6) 50)) | 71 | (should (equal (sm-test2 6) 50)) |
| 71 | (ad-deactivate 'sm-test2) | 72 | (ad-deactivate 'sm-test2) |
| 72 | (should (equal (sm-test2 6) 10)) | 73 | (should (equal (sm-test2 6) 10)) |
| @@ -81,8 +82,9 @@ | |||
| 81 | (should (equal (sm-test2 6) 20)) | 82 | (should (equal (sm-test2 6) 20)) |
| 82 | (should (equal (null (get 'sm-test2 'defalias-fset-function)) t)) | 83 | (should (equal (null (get 'sm-test2 'defalias-fset-function)) t)) |
| 83 | 84 | ||
| 84 | (defadvice sm-test4 (around wrap-with-toto activate) | 85 | (with-suppressed-warnings ((obsolete defadvice)) |
| 85 | ad-do-it (setq ad-return-value `(toto ,ad-return-value))) | 86 | (defadvice sm-test4 (around wrap-with-toto activate) |
| 87 | ad-do-it (setq ad-return-value `(toto ,ad-return-value)))) | ||
| 86 | (defmacro sm-test4 (x) `(call-test4 ,x)) | 88 | (defmacro sm-test4 (x) `(call-test4 ,x)) |
| 87 | (should (equal (macroexpand '(sm-test4 56)) '(toto (call-test4 56)))) | 89 | (should (equal (macroexpand '(sm-test4 56)) '(toto (call-test4 56)))) |
| 88 | (defmacro sm-test4 (x) `(call-testq ,x)) | 90 | (defmacro sm-test4 (x) `(call-testq ,x)) |
| @@ -90,8 +92,9 @@ | |||
| 90 | 92 | ||
| 91 | ;; This used to signal an error (bug#12858). | 93 | ;; This used to signal an error (bug#12858). |
| 92 | (autoload 'sm-test6 "foo") | 94 | (autoload 'sm-test6 "foo") |
| 93 | (defadvice sm-test6 (around test activate) | 95 | (with-suppressed-warnings ((obsolete defadvice)) |
| 94 | ad-do-it)) | 96 | (defadvice sm-test6 (around test activate) |
| 97 | ad-do-it))) | ||
| 95 | 98 | ||
| 96 | (ert-deftest advice-tests-combination () | 99 | (ert-deftest advice-tests-combination () |
| 97 | "Combining old style and new style advices." | 100 | "Combining old style and new style advices." |
| @@ -100,8 +103,9 @@ | |||
| 100 | (should (equal (sm-test5 6) 10)) | 103 | (should (equal (sm-test5 6) 10)) |
| 101 | (advice-add 'sm-test5 :around (lambda (f y) (* (funcall f y) 5))) | 104 | (advice-add 'sm-test5 :around (lambda (f y) (* (funcall f y) 5))) |
| 102 | (should (equal (sm-test5 6) 50)) | 105 | (should (equal (sm-test5 6) 50)) |
| 103 | (defadvice sm-test5 (around test activate) | 106 | (with-suppressed-warnings ((obsolete defadvice)) |
| 104 | ad-do-it (setq ad-return-value (+ ad-return-value 0.1))) | 107 | (defadvice sm-test5 (around test activate) |
| 108 | ad-do-it (setq ad-return-value (+ ad-return-value 0.1)))) | ||
| 105 | (should (equal (sm-test5 5) 45.1)) | 109 | (should (equal (sm-test5 5) 45.1)) |
| 106 | (ad-deactivate 'sm-test5) | 110 | (ad-deactivate 'sm-test5) |
| 107 | (should (equal (sm-test5 6) 50)) | 111 | (should (equal (sm-test5 6) 50)) |
| @@ -174,18 +178,20 @@ function being an around advice." | |||
| 174 | (ert-deftest advice-test-interactive () | 178 | (ert-deftest advice-test-interactive () |
| 175 | "Check handling of interactive spec." | 179 | "Check handling of interactive spec." |
| 176 | (defun sm-test8 (a) (interactive "p") a) | 180 | (defun sm-test8 (a) (interactive "p") a) |
| 177 | (defadvice sm-test8 (before adv1 activate) nil) | 181 | (with-suppressed-warnings ((obsolete defadvice)) |
| 178 | (defadvice sm-test8 (before adv2 activate) (interactive "P") nil) | 182 | (defadvice sm-test8 (before adv1 activate) nil) |
| 183 | (defadvice sm-test8 (before adv2 activate) (interactive "P") nil)) | ||
| 179 | (should (equal (interactive-form 'sm-test8) '(interactive "P")))) | 184 | (should (equal (interactive-form 'sm-test8) '(interactive "P")))) |
| 180 | 185 | ||
| 181 | (ert-deftest advice-test-preactivate () | 186 | (ert-deftest advice-test-preactivate () |
| 182 | (should (equal (null (get 'sm-test9 'defalias-fset-function)) t)) | 187 | (should (equal (null (get 'sm-test9 'defalias-fset-function)) t)) |
| 183 | (defun sm-test9 (a) (interactive "p") a) | 188 | (defun sm-test9 (a) (interactive "p") a) |
| 184 | (should (equal (null (get 'sm-test9 'defalias-fset-function)) t)) | 189 | (should (equal (null (get 'sm-test9 'defalias-fset-function)) t)) |
| 185 | (defadvice sm-test9 (before adv1 pre act protect compile) nil) | 190 | (with-suppressed-warnings ((obsolete defadvice)) |
| 186 | (should (equal (null (get 'sm-test9 'defalias-fset-function)) nil)) | 191 | (defadvice sm-test9 (before adv1 pre act protect compile) nil) |
| 187 | (defadvice sm-test9 (before adv2 pre act protect compile) | 192 | (should (equal (null (get 'sm-test9 'defalias-fset-function)) nil)) |
| 188 | (interactive "P") nil) | 193 | (defadvice sm-test9 (before adv2 pre act protect compile) |
| 194 | (interactive "P") nil)) | ||
| 189 | (should (equal (interactive-form 'sm-test9) '(interactive "P")))) | 195 | (should (equal (interactive-form 'sm-test9) '(interactive "P")))) |
| 190 | 196 | ||
| 191 | (ert-deftest advice-test-multiples () | 197 | (ert-deftest advice-test-multiples () |