mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Ensure that getters and setters can be edebugged at the same time.
It's necessary to add a name suffix to setters defined with 'gv-define-setter' so that Edebug can distinguish between the getter and the setter (Bug#41853). * lisp/emacs-lisp/gv.el (gv-define-setter): Add a name suffix to setter definitions. * test/lisp/emacs-lisp/gv-tests.el (gv-setter-edebug): New regression test.
This commit is contained in:
parent
b3e7d046c3
commit
62cf8f1649
2 changed files with 20 additions and 1 deletions
|
|
@ -224,7 +224,7 @@ The first arg in ARGLIST (the one that receives VAL) receives an expression
|
|||
which can do arbitrary things, whereas the other arguments are all guaranteed
|
||||
to be pure and copyable. Example use:
|
||||
(gv-define-setter aref (v a i) \\=`(aset ,a ,i ,v))"
|
||||
(declare (indent 2) (debug (&define name sexp def-body)))
|
||||
(declare (indent 2) (debug (&define name :name gv-setter sexp def-body)))
|
||||
`(gv-define-expander ,name
|
||||
(lambda (do &rest args)
|
||||
(declare-function
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(require 'edebug)
|
||||
(require 'ert)
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
|
||||
|
|
@ -137,6 +138,24 @@
|
|||
(should (equal (buffer-string)
|
||||
"Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n")))))
|
||||
|
||||
(ert-deftest gv-setter-edebug ()
|
||||
"Check that a setter can be defined and edebugged together with
|
||||
its getter (Bug#41853)."
|
||||
(with-temp-buffer
|
||||
(let ((edebug-all-defs t)
|
||||
(edebug-initial-mode 'Go-nonstop))
|
||||
(dolist (form '((defun gv-setter-edebug-help (b) b)
|
||||
(defun gv-setter-edebug-get (a b)
|
||||
(get a (gv-setter-edebug-help b)))
|
||||
(gv-define-setter gv-setter-edebug-get (x a b)
|
||||
`(setf (get ,a (gv-setter-edebug-help ,b)) ,x))
|
||||
(push 123 (gv-setter-edebug-get 'gv-setter-edebug
|
||||
'gv-setter-edebug-prop))))
|
||||
(print form (current-buffer)))
|
||||
;; Only check whether evaluation works in general.
|
||||
(eval-buffer)))
|
||||
(should (equal (get 'gv-setter-edebug 'gv-setter-edebug-prop) '(123))))
|
||||
|
||||
;; `ert-deftest' messes up macroexpansion when the test file itself is
|
||||
;; compiled (see Bug #24402).
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue