diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-11-06 16:05:02 +0100 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-11-06 19:16:05 +0100 |
commit | 83422370c87000f3d6d89320d4947c24325c9ad2 (patch) | |
tree | 69c393a2f4272c03324c1dabe5bbf67da2002469 /test/lisp/progmodes/project-tests.el | |
parent | bf2e35c5d25a8d1ed5ceacfd6171233bc75eae01 (diff) | |
download | emacs-83422370c87000f3d6d89320d4947c24325c9ad2.tar.gz emacs-83422370c87000f3d6d89320d4947c24325c9ad2.tar.bz2 emacs-83422370c87000f3d6d89320d4947c24325c9ad2.zip |
Replace some macros with ert-with-temp-(file|directory)
* test/lisp/custom-tests.el (custom-tests--with-temp-dir):
* test/lisp/files-tests.el (files-tests--with-temp-file):
* test/lisp/progmodes/project-tests.el
(project-tests--with-temporary-directory):
* test/src/emacs-module-tests.el (module--with-temp-directory):
* test/src/emacs-tests.el (emacs-tests--with-temp-file):
* test/src/lread-tests.el (lread-tests--with-temp-file):
* test/src/process-tests.el (process-tests--with-temp-directory):
Replace macros with 'ert-with-temp-(file|directory)'. Update callers.
Diffstat (limited to 'test/lisp/progmodes/project-tests.el')
-rw-r--r-- | test/lisp/progmodes/project-tests.el | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/test/lisp/progmodes/project-tests.el b/test/lisp/progmodes/project-tests.el index 1e3f258ac2a..a469414a743 100644 --- a/test/lisp/progmodes/project-tests.el +++ b/test/lisp/progmodes/project-tests.el @@ -29,29 +29,17 @@ (require 'cl-lib) (require 'ert) +(require 'ert-x) ; ert-with-temp-directory (require 'grep) (require 'xref) -(defmacro project-tests--with-temporary-directory (var &rest body) - "Create a new temporary directory. -Bind VAR to the name of the directory, and evaluate BODY. Delete -the directory after BODY exits." - (declare (debug (symbolp body)) (indent 1)) - (cl-check-type var symbol) - (let ((directory (make-symbol "directory"))) - `(let ((,directory (make-temp-file "project-tests-" :directory))) - (unwind-protect - (let ((,var ,directory)) - ,@body) - (delete-directory ,directory :recursive))))) - (ert-deftest project/quoted-directory () "Check that `project-files' and `project-find-regexp' deal with quoted directory names (Bug#47799)." (skip-unless (executable-find find-program)) (skip-unless (executable-find "xargs")) (skip-unless (executable-find "grep")) - (project-tests--with-temporary-directory directory + (ert-with-temp-directory directory (let ((default-directory directory) (project-current-inhibit-prompt t) (project-find-functions nil) @@ -95,7 +83,7 @@ quoted directory names (Bug#47799)." returned by `project-ignores' if the root directory is a directory name (Bug#48471)." (skip-unless (executable-find find-program)) - (project-tests--with-temporary-directory dir + (ert-with-temp-directory dir (make-empty-file (expand-file-name "some-file" dir)) (make-empty-file (expand-file-name "ignored-file" dir)) (let* ((project (make-project-tests--trivial @@ -111,7 +99,7 @@ directory name (Bug#48471)." "Check that `project-files' does not ignore all files. When `project-ignores' includes a name matching project dir." (skip-unless (executable-find find-program)) - (project-tests--with-temporary-directory dir + (ert-with-temp-directory dir (make-empty-file (expand-file-name "some-file" dir)) (let* ((project (make-project-tests--trivial :root (file-name-as-directory dir) |