From 2f95a95041d070b60cb54d91480c83e96ea73325 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 21 Sep 2020 16:58:46 +0100 Subject: [PATCH] Add a test for byte-compilation * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-byte-compile-a-file): New test. (elisp-shorthand-load-a-file): Simplify. --- test/lisp/progmodes/elisp-mode-tests.el | 26 ++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index bc9e103768e..684ac83f3c0 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1054,9 +1054,29 @@ evaluation of BODY." (error "this file needs to be loaded"))))) (ert-deftest elisp-shorthand-load-a-file () - (let ((load-path (cons elisp--test-resources-dir - load-path))) - (load "simple-shorthand-test") + (let ((test-file (expand-file-name "simple-shorthand-test.el" + elisp--test-resources-dir))) + (mapatoms (lambda (s) + (when (string-match "^elisp--foo-" (symbol-name s)) + (unintern s obarray)))) + (load test-file) + (should (intern-soft "elisp--foo-test")) + (should-not (intern-soft "f-test")))) + +(ert-deftest elisp-shorthand-byte-compile-a-file () + + (let ((test-file (expand-file-name "simple-shorthand-test.el" + elisp--test-resources-dir)) + (byte-compiled (expand-file-name "simple-shorthand-test.elc" + elisp--test-resources-dir))) + (mapatoms (lambda (s) + (when (string-match "^elisp--foo-" (symbol-name s)) + (unintern s obarray)))) + (byte-compile-file test-file) + (should-not (intern-soft "f-test")) + (should (intern-soft "elisp--foo-test")) + (should-not (fboundp (intern-soft "elisp--foo-test"))) + (load byte-compiled) (should (intern-soft "elisp--foo-test")) (should-not (intern-soft "f-test")))) -- 2.39.5