[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ssh-deploy 8107b9e 073/133: Added unit test for rename
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ssh-deploy 8107b9e 073/133: Added unit test for rename and delete |
Date: |
Sat, 27 Mar 2021 14:48:46 -0400 (EDT) |
branch: externals/ssh-deploy
commit 8107b9e23632c09b9e5b1952932c17c90e1b7062
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added unit test for rename and delete
---
ssh-deploy-test.el | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 77 insertions(+), 2 deletions(-)
diff --git a/ssh-deploy-test.el b/ssh-deploy-test.el
index bd36006..d9ea802 100644
--- a/ssh-deploy-test.el
+++ b/ssh-deploy-test.el
@@ -45,7 +45,6 @@
(defun ssh-deploy-test--download ()
"Test downloads."
-
(let ((directory-a (expand-file-name "test-a/"))
(directory-b (expand-file-name "test-b/")))
@@ -94,6 +93,81 @@
(delete-directory directory-a t)
(delete-directory directory-b t)))
+(defun ssh-deploy-test--rename-and-delete ()
+ "Test downloads."
+ (let ((directory-a (expand-file-name "test-a/"))
+ (directory-b (expand-file-name "test-b/"))
+ (filename-old "testfile.txt")
+ (filename-new "testfile-renamed.txt"))
+
+ ;; Delete directories if they already exists
+ (when (file-directory-p directory-a)
+ (delete-directory directory-a t))
+ (when (file-directory-p directory-b)
+ (delete-directory directory-b t))
+
+ (make-directory-internal directory-a)
+ (make-directory-internal directory-b)
+
+ (let* ((file-a-old (expand-file-name filename-old directory-a))
+ (file-a-new (expand-file-name filename-new directory-a))
+ (file-b-old (expand-file-name filename-old directory-b))
+ (file-b-new (expand-file-name filename-new directory-b))
+ (file-contents "Random text")
+ (ssh-deploy-root-local directory-a)
+ (ssh-deploy-root-remote directory-b)
+ (ssh-deploy-on-explicit-save 0)
+ (ssh-deploy-async 0)
+ (ssh-deploy-verbose 0)
+ (ssh-deploy-debug 0))
+
+ ;; Just bypass the linter here
+ (when (and ssh-deploy-root-local
+ ssh-deploy-root-remote
+ ssh-deploy-on-explicit-save
+ ssh-deploy-async
+ ssh-deploy-verbose
+ ssh-deploy-debug)
+
+ ;; Create new files and add it's contents
+ (find-file file-a-old)
+ (insert file-contents)
+ (save-buffer)
+ (kill-buffer)
+
+ ;; Create new files and add it's contents
+ (find-file file-b-old)
+ (insert file-contents)
+ (save-buffer)
+ (kill-buffer)
+
+ ;; Both files should exist
+ (should (equal t (file-exists-p file-a-old)))
+ (should (equal t (file-exists-p file-b-old)))
+
+ ;; Rename filename
+ (find-file file-a-old)
+ (ssh-deploy-rename file-a-old file-a-new)
+
+ ;; Both old files should not exist anymore
+ (should (equal nil (file-exists-p file-a-old)))
+ (should (equal nil (file-exists-p file-b-old)))
+
+ ;; Both new files should exist anymore
+ (should (equal t (file-exists-p file-a-new)))
+ (should (equal t (file-exists-p file-b-new)))
+
+ ;; Delete file
+ (ssh-deploy-delete-both file-a-new)
+ (kill-buffer)
+
+ ;; Both new files should not exist anymore
+ (should (equal nil (file-exists-p file-a-new)))
+ (should (equal nil (file-exists-p file-b-new)))))
+
+ (delete-directory directory-a t)
+ (delete-directory directory-b t)))
+
(defun ssh-deploy-test--upload ()
"Test uploads."
@@ -184,7 +258,8 @@
(ssh-deploy-test--file-is-in-path)
(ssh-deploy-test--is-not-empty-string)
(ssh-deploy-test--upload)
- (ssh-deploy-test--download))
+ (ssh-deploy-test--download)
+ (ssh-deploy-test--rename-and-delete))
(ssh-deploy-test)
- [elpa] externals/ssh-deploy 7a5a087 066/133: Updated version, (continued)
- [elpa] externals/ssh-deploy 7a5a087 066/133: Updated version, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 664f52c 072/133: Improved missing async function error and replaced require with autoload, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 8c354e1 092/133: Added Travis CI file to repo, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy f61f1ef 041/133: Fixed bug where all DirectoryVariables was not passed on from handlers, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy a1a9d3c 051/133: Work on lisp code styling with (if), (progn) and (when), Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy e0bf686 054/133: More (if), (when) and (progn) optimizations, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy efc8be3 058/133: Added another example using plug-in functions from script, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 4044f78 064/133: Hydra compilation working, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy ae5354a 065/133: Fixed issue were remote paths with symlinks didn't work with recursive diff function, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 6e37aae 067/133: Added unit test for download, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 8107b9e 073/133: Added unit test for rename and delete,
Stefan Monnier <=
- [elpa] externals/ssh-deploy e895d6d 079/133: Replaced asynchronous (require) with (autoload), Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 5846974 082/133: Added instructions about how to trigger unit test with async.el integration, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 85a7c37 080/133: Added unit tests for asynchronous operations, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 6ddb12b 090/133: All unit tests for remote changes sync and async and compilation passing, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 8e2507b 085/133: Refactored remote changes function and made unit tests for it, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 8c26f61 091/133: Updated version and change-date, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 6d20dae 109/133: Fixed issue were async directory diff would lock main thread for resolving file links when using the handler, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 9c73fef 110/133: Added support for asynchronous file difference check, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 045e463 095/133: Trying emacs version manager in travis, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 438c1b4 107/133: Do not allow failures on emacs snapshot, Stefan Monnier, 2021/03/27