emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 4fe9a9e: Clean up temp files after some tests


From: Glenn Morris
Subject: [Emacs-diffs] master 4fe9a9e: Clean up temp files after some tests
Date: Mon, 14 Aug 2017 17:23:26 -0400 (EDT)

branch: master
commit 4fe9a9efcfdd39c5751d4506e94afaf28fcbcaef
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Clean up temp files after some tests
    
    * test/lisp/emacs-lisp/bytecomp-tests.el
    (bytecomp-tests--with-temp-file): Also delete .elc file if present.
    * test/lisp/progmodes/etags-tests.el
    (etags-buffer-local-tags-table-list): Delete temp file at end.
---
 test/lisp/emacs-lisp/bytecomp-tests.el |  4 +++-
 test/lisp/progmodes/etags-tests.el     | 27 +++++++++++++++------------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el 
b/test/lisp/emacs-lisp/bytecomp-tests.el
index 8ef2ce7..ab70b30 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -512,7 +512,9 @@ bytecompiled code, and their results compared.")
   `(let ((,file-name-var (make-temp-file "emacs")))
      (unwind-protect
          (progn ,@body)
-       (delete-file ,file-name-var))))
+       (delete-file ,file-name-var)
+       (let ((elc (concat ,file-name-var ".elc")))
+         (if (file-exists-p elc) (delete-file elc))))))
 
 (ert-deftest bytecomp-tests--unescaped-char-literals ()
   "Check that byte compiling warns about unescaped character
diff --git a/test/lisp/progmodes/etags-tests.el 
b/test/lisp/progmodes/etags-tests.el
index 0153f32..845f3fe 100644
--- a/test/lisp/progmodes/etags-tests.el
+++ b/test/lisp/progmodes/etags-tests.el
@@ -96,15 +96,18 @@
 (ert-deftest etags-buffer-local-tags-table-list ()
   "Test that a buffer-local value of `tags-table-list' is used."
   (let ((file (make-temp-file "etag-test-tmpfile")))
-    (set-buffer (find-file-noselect file))
-    (fundamental-mode)
-    (setq-local tags-table-list
-                (list (expand-file-name "manual/etags/ETAGS.good_3"
-                                        etags-tests--test-dir)))
-    (cl-letf ((tag-tables tags-table-list)
-              (tags-file-name nil)
-              ((symbol-function 'read-file-name)
-               (lambda (&rest _)
-                 (error "We should not prompt the user"))))
-      (should (visit-tags-table-buffer))
-      (should (equal tags-file-name (car tag-tables))))))
+    (unwind-protect
+        (progn
+          (set-buffer (find-file-noselect file))
+          (fundamental-mode)
+          (setq-local tags-table-list
+                      (list (expand-file-name "manual/etags/ETAGS.good_3"
+                                              etags-tests--test-dir)))
+          (cl-letf ((tag-tables tags-table-list)
+                    (tags-file-name nil)
+                    ((symbol-function 'read-file-name)
+                     (lambda (&rest _)
+                       (error "We should not prompt the user"))))
+            (should (visit-tags-table-buffer))
+            (should (equal tags-file-name (car tag-tables)))))
+      (delete-file file))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]