Improve sectioning in bytecomp-tests.el

* test/lisp/emacs-lisp/bytecomp-tests.el: Add section comments.
(test-eager-load-macro-expansion)
(test-eager-load-macro-expansion-eval-and-compile): Move definitions.
This commit is contained in:
Stefan Kangas 2020-12-02 11:29:26 +01:00
parent b7c43b85fa
commit 17d9d90ec2

View file

@ -490,6 +490,9 @@ Subtests signal errors if something goes wrong."
(defun def () (m))))
(should (equal (funcall 'def) 4)))
;;;; Warnings.
(ert-deftest bytecomp-tests--warnings ()
(with-current-buffer (get-buffer-create "*Compile-Log*")
(let ((inhibit-read-only t)) (erase-buffer)))
@ -537,16 +540,6 @@ Subtests signal errors if something goes wrong."
(bytecomp--with-warning-test "foo.*lacks a prefix"
'(defvar foo nil)))
(ert-deftest test-eager-load-macro-expansion ()
(test-byte-comp-compile-and-load nil
'(progn (defmacro abc (arg) 1) (defun def () (abc 2))))
(should (equal (funcall 'def) 1)))
(ert-deftest test-eager-load-macro-expansion-eval-and-compile ()
(test-byte-comp-compile-and-load nil
'(eval-and-compile (defmacro abc (arg) -1) (defun def () (abc 2))))
(should (equal (funcall 'def) -1)))
(defmacro bytecomp--define-warning-file-test (file re-warning &optional reverse)
`(ert-deftest ,(intern (format "bytecomp/%s" file)) ()
:expected-result ,(if reverse :failed :passed)
@ -598,6 +591,19 @@ Subtests signal errors if something goes wrong."
(bytecomp--define-warning-file-test "warn-interactive-only.el"
"next-line.*interactive use only.*forward-line")
;;;; Macro expansion.
(ert-deftest test-eager-load-macro-expansion ()
(test-byte-comp-compile-and-load nil
'(progn (defmacro abc (arg) 1) (defun def () (abc 2))))
(should (equal (funcall 'def) 1)))
(ert-deftest test-eager-load-macro-expansion-eval-and-compile ()
(test-byte-comp-compile-and-load nil
'(eval-and-compile (defmacro abc (arg) -1) (defun def () (abc 2))))
(should (equal (funcall 'def) -1)))
(ert-deftest test-eager-load-macro-expansion-eval-when-compile ()
;; Make sure we interpret eval-when-compile forms properly. CLISP
;; and SBCL interpreter eval-when-compile (well, the CL equivalent)