]> git.eshelyaron.com Git - emacs.git/commitdiff
Use ert-resource-file in the shorthand tests
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 28 Sep 2021 04:49:03 +0000 (06:49 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 28 Sep 2021 04:49:03 +0000 (06:49 +0200)
Also move to the standard directory naming.

test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el [new file with mode: 0644]
test/lisp/progmodes/elisp-mode-tests.el
test/lisp/progmodes/elisp-resources/simple-shorthand-test.el [deleted file]

diff --git a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el
new file mode 100644 (file)
index 0000000..ec56809
--- /dev/null
@@ -0,0 +1,30 @@
+(defun f-test ()
+  (let ((elisp-shorthands '(("foo-" . "bar-"))))
+    (with-temp-buffer
+      (insert "(foo-bar)")
+      (goto-char (point-min))
+      (read (current-buffer)))))
+
+(defun f-test2 ()
+  (let ((elisp-shorthands '(("foo-" . "bar-"))))
+    (read-from-string "(foo-bar)")))
+
+
+(defun f-test3 ()
+  (let ((elisp-shorthands '(("foo-" . "bar-"))))
+    (intern "foo-bar")))
+
+(defvar f-test-complete-me 42)
+
+(defun #_f-test4--- () 84)
+
+(when nil
+  (f-test3)
+  (f-test2)
+  (f-test)
+  (#_f-test4---))
+
+
+;; Local Variables:
+;; elisp-shorthands: (("f-" . "elisp--foo-"))
+;; End:
index e0e2cb112eb58cf450427311810df536119d82eb..a2bd1b8b275f0cbdeac3588d7ddd1b3d2d7398b5 100644 (file)
@@ -23,6 +23,7 @@
 ;;; Code:
 
 (require 'ert)
+(require 'ert-x)
 (require 'xref)
 (eval-when-compile (require 'cl-lib))
 
@@ -1047,15 +1048,8 @@ evaluation of BODY."
                    expected))
     (should (not (intern-soft shorthand-sname)))))
 
-(defvar elisp--test-resources-dir
-  (expand-file-name "elisp-resources/"
-                    (file-name-directory
-                     (or load-file-name
-                         (error "this file needs to be loaded")))))
-
 (ert-deftest elisp-shorthand-load-a-file ()
-  (let ((test-file (expand-file-name "simple-shorthand-test.el"
-                                     elisp--test-resources-dir)))
+  (let ((test-file (ert-resource-file "simple-shorthand-test.el")))
     (mapatoms (lambda (s)
                 (when (string-match "^elisp--foo-" (symbol-name s))
                   (unintern s obarray))))
@@ -1065,10 +1059,8 @@ evaluation of BODY."
 
 (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)))
+  (let ((test-file (ert-resource-file "simple-shorthand-test.el"))
+        (byte-compiled (ert-resource-file "simple-shorthand-test.elc")))
     (mapatoms (lambda (s)
                 (when (string-match "^elisp--foo-" (symbol-name s))
                   (unintern s obarray))))
@@ -1081,8 +1073,7 @@ evaluation of BODY."
     (should-not (intern-soft "f-test"))))
 
 (ert-deftest elisp-shorthand-completion-at-point ()
-  (let ((test-file (expand-file-name "simple-shorthand-test.el"
-                                     elisp--test-resources-dir)))
+  (let ((test-file (ert-resource-file "simple-shorthand-test.el")))
     (load test-file)
     (with-current-buffer (find-file-noselect test-file)
       (revert-buffer t t)
@@ -1097,8 +1088,7 @@ evaluation of BODY."
       (revert-buffer t t))))
 
 (ert-deftest elisp-shorthand-escape ()
-  (let ((test-file (expand-file-name "simple-shorthand-test.el"
-                                     elisp--test-resources-dir)))
+  (let ((test-file (ert-resource-file "simple-shorthand-test.el")))
     (load test-file)
     (should (intern-soft "f-test4---"))
     (should-not (intern-soft "elisp--foo-test4---"))
diff --git a/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-resources/simple-shorthand-test.el
deleted file mode 100644 (file)
index ec56809..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-(defun f-test ()
-  (let ((elisp-shorthands '(("foo-" . "bar-"))))
-    (with-temp-buffer
-      (insert "(foo-bar)")
-      (goto-char (point-min))
-      (read (current-buffer)))))
-
-(defun f-test2 ()
-  (let ((elisp-shorthands '(("foo-" . "bar-"))))
-    (read-from-string "(foo-bar)")))
-
-
-(defun f-test3 ()
-  (let ((elisp-shorthands '(("foo-" . "bar-"))))
-    (intern "foo-bar")))
-
-(defvar f-test-complete-me 42)
-
-(defun #_f-test4--- () 84)
-
-(when nil
-  (f-test3)
-  (f-test2)
-  (f-test)
-  (#_f-test4---))
-
-
-;; Local Variables:
-;; elisp-shorthands: (("f-" . "elisp--foo-"))
-;; End: