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

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

[elpa] externals/hyperbole 7aad410a66: Add test for hpath:auto-variable-


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 7aad410a66: Add test for hpath:auto-variable-alist (#146)
Date: Thu, 6 Jan 2022 03:57:35 -0500 (EST)

branch: externals/hyperbole
commit 7aad410a660e150e47e8d77f07be15d9701914bb
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>

    Add test for hpath:auto-variable-alist (#146)
    
    * Add test for hpath:auto-variable-alist
    
    * Test for quoted and not quoted filename
---
 ChangeLog           |  8 ++++++++
 test/hpath-tests.el | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 5860e2c84f..511c82888f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-01-06  Mats Lidell  <matsl@gnu.org>
+
+* test/hpath-tests.el (hpath:auto-variable-alist-load-path-test)
+    (hpath:auto-variable-alist-org-folder-test)
+    (hpath:auto-variable-alist-pythonpath-test): Add tests for
+    hpath:auto-variable-alist patterns.
+    (hpath-tests--insert): Add test helper.
+
 2022-01-02  Bob Weiner  <rsw@gnu.org>
 
 * test/hpath-tests.el (hpath:should-exist-paths, hpath:should-not-exist-paths):
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index f1d7d10c5d..74c73cd38f 100644
--- a/test/hpath-tests.el
+++ b/test/hpath-tests.el
@@ -210,5 +210,43 @@
             (hy-test-helpers:action-key-should-call-hpath:find 
(expand-file-name file hyperb:dir))))
       (kill-buffer shell-buffer))))
 
+(defun hpath-tests--insert (str &optional with-quotes)
+  "Insert STR with quotes if WITH-QUOTES is not nil."
+  (concat (when with-quotes "\"") str (when with-quotes "\"")))
+
+(ert-deftest hpath:auto-variable-alist-load-path-test ()
+  "An elisp file should be looked up in the load path."
+  (let ((load-path (list hyperb:dir))
+        (el-file "hyperbole.el"))
+    (dolist (with-quotes '(nil t))
+      (with-temp-buffer
+        (insert (hpath-tests--insert el-file with-quotes))
+        (goto-char 4)
+        (hy-test-helpers:action-key-should-call-hpath:find (expand-file-name 
el-file hyperb:dir))))))
+
+(ert-deftest hpath:auto-variable-alist-org-folder-test ()
+  "An org file should be looked up in the org directory."
+  (let ((org-directory (expand-file-name "HY-TALK" hyperb:dir))
+        (org-file "HY-TALK.org"))
+    (dolist (with-quotes '(nil t))
+      (with-temp-buffer
+        (insert (hpath-tests--insert org-file with-quotes))
+        (goto-char 4)
+        (hy-test-helpers:action-key-should-call-hpath:find (expand-file-name 
org-file org-directory))))))
+
+(ert-deftest hpath:auto-variable-alist-pythonpath-test ()
+  "A python file should be looked up in the PYTHONPATH."
+  (let ((py-file "topwin.py")
+        (old-python-path (getenv "PYTHONPATH")))
+    (unwind-protect
+        (progn
+          (setenv "PYTHONPATH" hyperb:dir)
+          (dolist (with-quotes '(nil t))
+            (with-temp-buffer
+              (insert (hpath-tests--insert py-file with-quotes))
+              (goto-char 4)
+              (hy-test-helpers:action-key-should-call-hpath:find 
(expand-file-name py-file hyperb:dir)))))
+      (setenv "PYTHONPATH" old-python-path))))
+
 (provide 'hpath-tests)
 ;;; hpath-tests.el ends here



reply via email to

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