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

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

[elpa] externals/ssh-deploy 95a932a 047/133: Started on unit-tests


From: Stefan Monnier
Subject: [elpa] externals/ssh-deploy 95a932a 047/133: Started on unit-tests
Date: Sat, 27 Mar 2021 14:48:41 -0400 (EDT)

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

    Started on unit-tests
---
 Makefile           | 11 ++++++++++
 README.md          |  5 +++++
 ssh-deploy-test.el | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1165d6c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,11 @@
+EMACS = emacs
+ifdef emacs
+       EMACS = $(emacs)
+endif
+
+EMACS_CMD := $(EMACS) -Q -batch -L .
+
+.PHONY: tests
+tests:
+       $(EMACS_CMD) -l ssh-deploy-test.el
+
diff --git a/README.md b/README.md
index 5e5967a..916e418 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@
 The `ssh-deploy` plug-in for Emacs makes it possible to effortlessly deploy 
local files and directories to remote hosts via TRAMP (including but not 
limited to SSH, SFTP, FTP). It tries to provide functions that can be easily 
used by custom scripts.
 
 ## Features:
+
 * Define syncing configuration per directory or per file (using 
`DirectoryVariables` or `File Variables`)
 * Control whether uploads of files should be automatic on save
 * Manual downloads and uploads of directories and files
@@ -238,6 +239,10 @@ Ange-FTP defaults to `~/.netrc` so you need to add this to 
your init script:
 (setq ange-ftp-netrc-filename "~/.authinfo.gpg")
 ```
 
+## Tests
+
+Run `make tests` from plug-in folder to run tests, if you need to specify 
specific Emacs use export syntax i.e. `export emacs="YOUR_PATH" && make tests`
+
 ## Read more
 * <https://www.gnu.org/software/tramp/>
 * <https://elpa.gnu.org/>
diff --git a/ssh-deploy-test.el b/ssh-deploy-test.el
new file mode 100644
index 0000000..d0cffbc
--- /dev/null
+++ b/ssh-deploy-test.el
@@ -0,0 +1,62 @@
+;;; ssh-deploy-test.el --- Unit and integration tests for ssh-deploy.  -*- 
lexical-binding:t -*-
+
+;; Copyright (C) 2017-2018  Free Software Foundation, Inc.
+
+;; Author: Christian Johansson <christian@cvj.se>
+;; Maintainer: Christian Johansson <christian@cvj.se>
+;; Created: 5 Jul 2016
+;; Modified: 28 Nov 2018
+;; Version: 3.0
+;; Keywords: tools, convenience
+;; URL: https://github.com/cjohansson/emacs-ssh-deploy
+
+;; Package-Requires: ((emacs "24"))
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 3, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+
+;;; Commentary:
+
+
+;; This file contains unit and integration tests for ssh-deploy plug-in for 
Emacs.
+
+
+;;; Code:
+
+
+(autoload 'ssh-deploy-diff-mode "ssh-deploy-diff-mode")
+(autoload 'ssh-deploy "ssh-deploy")
+(autoload 'ssh-deploy--file-is-in-path "ssh-deploy")
+(autoload 'should "ert")
+
+(defun ssh-deploy-test--file-is-in-path ()
+  "Test this function."
+  (should (equal t (ssh-deploy--file-is-in-path "/mydirectory/test.txt" 
"/mydirectory/")))
+  (should (equal nil (ssh-deploy--file-is-in-path "/mydirectory/test.txt" 
"/mydirectory2/")))
+  (should (equal nil (ssh-deploy--file-is-in-path "/mydirectory2/test.txt" 
"/mydirectory/")))
+  )
+
+
+(defun ssh-deploy-tests ()
+  "Run test for plug-in."
+  (ssh-deploy-test--file-is-in-path)
+  )
+
+(ssh-deploy-tests)
+
+
+(provide 'ssh-deploy-test)
+;;; ssh-deploy-test.el ends here



reply via email to

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