* lisp/emacs-lisp/bindat.el (bindat-spec): New macro.

It's basically an alias for `quote`, but it offers the advantage of
providing Edebug support and opens the possibility of compiling
the bindat spec to ELisp code.

* doc/lispref/processes.texi (Bindat Spec): Document `bindat-spec`.
(Bindat Functions): Tweak a few things to adjust to the state of the code.

* test/lisp/emacs-lisp/bindat-tests.el: Use it.

* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests--read): New function.
(edebug-tests--&rest-behavior): New test.
This commit is contained in:
Stefan Monnier 2021-02-15 21:25:15 -05:00
parent 2106b12fa7
commit 83d9fbe3bb
5 changed files with 91 additions and 24 deletions

View file

@ -970,6 +970,23 @@ primary ones (Bug#42671)."
(eval '(setf (edebug-test-code-use-gv-expander (cons 'a 'b)) 3) t))
"(func"))))
(defun edebug-tests--read (form spec)
(with-temp-buffer
(print form (current-buffer))
(goto-char (point-min))
(cl-letf ((edebug-all-forms t)
((get (car form) 'edebug-form-spec) spec))
(edebug--read nil (current-buffer)))))
(ert-deftest edebug-tests--&rest-behavior ()
;; `&rest' is documented to allow the last "repetition" to be aborted early.
(should (edebug-tests--read '(dummy x 1 y 2 z)
'(&rest symbolp integerp)))
;; `&rest' should notice here that the "symbolp integerp" sequence
;; is not respected.
(should-error (edebug-tests--read '(dummy x 1 2 y)
'(&rest symbolp integerp))))
(ert-deftest edebug-tests-cl-flet ()
"Check that Edebug can instrument `cl-flet' forms without name
clashes (Bug#41853)."