emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ssh-deploy c7407ef 069/133: Using (kill-buffer) instead


From: Stefan Monnier
Subject: [elpa] externals/ssh-deploy c7407ef 069/133: Using (kill-buffer) instead of reverting default-directory in unit tests
Date: Sat, 27 Mar 2021 14:48:45 -0400 (EDT)

branch: externals/ssh-deploy
commit c7407ef2d549a54922e8d4966754aeca3dbda06e
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Using (kill-buffer) instead of reverting default-directory in unit tests
---
 ssh-deploy-test.el | 71 ++++++++++++++++++++++++------------------------------
 1 file changed, 31 insertions(+), 40 deletions(-)

diff --git a/ssh-deploy-test.el b/ssh-deploy-test.el
index b380a6f..8c96b39 100644
--- a/ssh-deploy-test.el
+++ b/ssh-deploy-test.el
@@ -71,24 +71,20 @@
                  ssh-deploy-verbose
                  ssh-deploy-debug)
 
-        (let ((old-default-directory default-directory))
-
-          ;; Create a new file and add it's contents
-          (find-file file-b)
-          (insert file-b-contents)
-          (save-buffer)
-
-          ;; Download file
-          (ssh-deploy-download file-b file-a 0 nil 0)
+        ;; Create a new file and add it's contents
+        (find-file file-b)
+        (insert file-b-contents)
+        (save-buffer)
+        (kill-buffer)
 
-          ;; Verify that both files have equal contents
-          (should (equal t (ediff-same-file-contents file-a file-b)))
+        ;; Download file
+        (ssh-deploy-download file-b file-a 0 nil 0)
 
-          (delete-file file-b)
-          (delete-file file-a)
+        ;; Verify that both files have equal contents
+        (should (equal t (ediff-same-file-contents file-a file-b)))
 
-          ;; (find-file) changes default-directory so we revert it here
-          (setq default-directory old-default-directory))))
+        (delete-file file-b)
+        (delete-file file-a)))
 
     (delete-directory directory-a t)
     (delete-directory directory-b t)))
@@ -128,38 +124,33 @@
                  ssh-deploy-verbose
                  ssh-deploy-debug)
 
-        ;; Create a new file and add it's contents
-        (let ((old-default-directory default-directory))
+        (ssh-deploy-add-after-save-hook)
+        (find-file file-a)
+        (insert file-a-contents)
+        (save-buffer) ;; NOTE Should trigger upload action
 
-          (ssh-deploy-add-after-save-hook)
-          (find-file file-a)
-          (insert file-a-contents)
-          (save-buffer) ;; NOTE Should trigger upload action
+        ;; Verify that both files have equal contents
+        (should (equal t (ediff-same-file-contents file-a file-b)))
 
-          ;; Verify that both files have equal contents
-          (should (equal t (ediff-same-file-contents file-a file-b)))
-
-          ;; Turn of automatic uploads
-          (let ((ssh-deploy-on-explicit-save 0))
-
-            ;; Update should not trigger upload
-            (insert file-a-contents)
-            (save-buffer)
+        ;; Turn of automatic uploads
+        (let ((ssh-deploy-on-explicit-save 0))
 
-            ;; Verify that both files have equal contents
-            (should (equal nil (ediff-same-file-contents file-a file-b)))
+          ;; Update should not trigger upload
+          (insert file-a-contents)
+          (save-buffer)
 
-            (ssh-deploy-upload-handler)
+          ;; Verify that both files have equal contents
+          (should (equal nil (ediff-same-file-contents file-a file-b)))
 
-            ;; Verify that both files have equal contents
-            (should (equal t (ediff-same-file-contents file-a file-b)))
+          (ssh-deploy-upload-handler)
+          (kill-buffer)
 
-            ;; Delete both test files
-            (delete-file file-b)
-            (delete-file file-a))
+          ;; Verify that both files have equal contents
+          (should (equal t (ediff-same-file-contents file-a file-b)))
 
-          ;; (find-file) changes default-directory so we revert it here
-          (setq default-directory old-default-directory))))
+          ;; Delete both test files
+          (delete-file file-b)
+          (delete-file file-a))))
 
     (delete-directory directory-a t)
     (delete-directory directory-b t)))



reply via email to

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