]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a test for byte-compilation scratch/shorthand-namespacing
authorJoão Távora <joaotavora@gmail.com>
Mon, 21 Sep 2020 15:58:46 +0000 (16:58 +0100)
committerJoão Távora <joaotavora@gmail.com>
Mon, 21 Sep 2020 16:01:08 +0000 (17:01 +0100)
* 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

index dee043bd3ecf5a4d854e2c4a6b1335ce3b919092..9621ab33c37e49cb98c75ae549743ca90c2a5ee8 100644 (file)
@@ -843,9 +843,29 @@ to (xref-elisp-test-descr-to-target xref)."
                          (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"))))