summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-11-06 21:54:02 +0100
committerStefan Kangas <stefan@marxist.se>2021-11-07 01:54:30 +0100
commit5dd27fef5885bf0f6ec3b12bad7972276834ccfa (patch)
treebc982d44266a2113172406affe4e4a3a12bf2aca /test/lisp
parent9dfd945a2c2055b1af869a685eb2a667daf4daca (diff)
downloademacs-5dd27fef5885bf0f6ec3b12bad7972276834ccfa.tar.gz
Add generated suffix to test temp file names
* lisp/emacs-lisp/ert-x.el (ert-with-temp-file): Add temp file name suffix based on file name of caller. Reflow docstring. (ert--with-temp-file-generate-suffix): New defun. * test/lisp/emacs-lisp/ert-x-tests.el (ert-x-tests--with-temp-file-generate-suffix): New test.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/emacs-lisp/ert-x-tests.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/ert-x-tests.el b/test/lisp/emacs-lisp/ert-x-tests.el
index 1eed5bb7b94..d7c0985b13e 100644
--- a/test/lisp/emacs-lisp/ert-x-tests.el
+++ b/test/lisp/emacs-lisp/ert-x-tests.el
@@ -271,6 +271,15 @@ desired effect."
(cl-loop for x in '(0 1 2 3 4 t) do
(should (equal (c x) (lisp x))))))
+(ert-deftest ert-x-tests--with-temp-file-generate-suffix ()
+ (should (equal (ert--with-temp-file-generate-suffix "foo.el") "-foo"))
+ (should (equal (ert--with-temp-file-generate-suffix "foo-test.el") "-foo"))
+ (should (equal (ert--with-temp-file-generate-suffix "foo-tests.el") "-foo"))
+ (should (equal (ert--with-temp-file-generate-suffix "foo-bar-baz.el")
+ "-foo-bar-baz"))
+ (should (equal (ert--with-temp-file-generate-suffix "/foo/bar/baz.el")
+ "-baz")))
+
(ert-deftest ert-x-tests-with-temp-file ()
(let (saved)
(ert-with-temp-file fil