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

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

[elpa] externals/hyperbole 92824c8 1/2: Path variable tests (#69)


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 92824c8 1/2: Path variable tests (#69)
Date: Sun, 18 Apr 2021 17:57:09 -0400 (EDT)

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

    Path variable tests (#69)
---
 Changes                | 13 +++++++++++++
 test/hbut-tests.el     | 28 ++++++++++++++++++++++++++++
 test/hibtypes-tests.el | 11 +++++++++++
 test/hpath-tests.el    | 14 ++++++++++++++
 4 files changed, 66 insertions(+)

diff --git a/Changes b/Changes
index 249d66c..b6ccc1b 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,18 @@
 2021-04-18  Mats Lidell  <matsl@gnu.org>
 
+* test/hbut-tests.el (hbut-pathname-path-variable-test)
+    (hbut-pathname-path-variable-with-two-colons-is-one-file-test)
+    (hbut-pathname-path-variable-with-three-colons-is-a-path-test)
+    (hbut-pathname-path-variable-with-short-first-elemet-is-tramp-url-test):
+    Test for path variables.
+
+* test/hibtypes-tests.el (ibtypes::pathname-path-variable-test): Ert test
+    for path variables.
+
+* test/hpath-tests.el (hpath:path-at-point-in-path-variable-test)
+    
(hpath:path-at-point-in-path-variable-shorter-than-three-colons-returns-nil-test):
+    Ert test for path variables.
+
 * Makefile (ELC_KOTL): Add kotl/kprop-em.elc
     (ELC_COMPILE): Remove kprop-em.elc
 
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index a0b581c..0619a74 100644
--- a/test/hbut-tests.el
+++ b/test/hbut-tests.el
@@ -194,5 +194,33 @@ the button text"
            (should (equal (car err) 'error))
            (should (string-search "ibutton at point already has a label" (cadr 
err)))))))))
 
+(ert-deftest hbut-pathname-path-variable-test ()
+  "Find file in path variable."
+  (with-temp-buffer
+    (insert "\"/var/lib:/bar:/tmp:/foo\"")
+    (goto-char 16)
+    (hy-test-helpers:action-key-should-call-hpath:find "/tmp")))
+
+(ert-deftest hbut-pathname-path-variable-with-two-colons-is-one-file-test ()
+  "Path variable with two colons is not seen as a path variable."
+  (with-temp-buffer
+    (insert "\"/var/lib:/bar:/tmp\"")
+    (goto-char 16)
+    (hy-test-helpers:action-key-should-call-hpath:find "/var/lib:/bar:/tmp")))
+
+(ert-deftest hbut-pathname-path-variable-with-three-colons-is-a-path-test ()
+  "Path variable with three colons is not seen as a path variable."
+  (with-temp-buffer
+    (insert "\"/var/lib:/bar:/tmp:/foo\"")
+    (goto-char 16)
+    (hy-test-helpers:action-key-should-call-hpath:find "/tmp")))
+
+(ert-deftest 
hbut-pathname-path-variable-with-short-first-elemet-is-tramp-url-test ()
+  "Path variable with three colons is a tramp url."
+  (with-temp-buffer
+    (insert "\"/var:/bar:/tmp:/foo\"")
+    (goto-char 14)
+    (hy-test-helpers:action-key-should-call-hpath:find "/anonymous@var:/bar")))
+
 (provide 'hbut-tests)
 ;;; hbut-tests.el ends here
diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el
index cacdc6c..d33d75f 100644
--- a/test/hibtypes-tests.el
+++ b/test/hibtypes-tests.el
@@ -178,6 +178,17 @@ Bug: Fails with 'Invalid function: hact'."
       (set-buffer help-buffer)
       (should (string-match "actype:.*link-to-file" (buffer-string))))))
 
+(ert-deftest ibtypes::pathname-path-variable-test ()
+  "Goto file at point in path variable."
+  (unwind-protect
+      (with-temp-buffer
+        (insert "\"/var/lib:/bar:/tmp:/foo\"")
+        (goto-char 16)
+        (ibtypes::pathname)
+        (should (string= "tmp" (buffer-name)))
+        (should (eq major-mode 'dired-mode)))
+    (kill-buffer "tmp")))
+
 ;; Function in buffer XEmac functionality. Is there somethign similar in Emacs?
 
 ;; ibtypes::annot-bib
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index 525433c..716c458 100644
--- a/test/hpath-tests.el
+++ b/test/hpath-tests.el
@@ -25,5 +25,19 @@
       (hpath:find "${hyperb:dir}/UNKNOWNFILE")
     (error (should (string-search (concat hyperb:dir "UNKNOWNFILE") (cadr 
err))))))
 
+(ert-deftest hpath:path-at-point-in-path-variable-test ()
+  "Find path at point in path variable."
+  (with-temp-buffer
+    (insert "\":foo:bar:emacs\"")
+    (goto-char 8)
+    (should (string= (hpath:at-p) "bar"))))
+
+(ert-deftest 
hpath:path-at-point-in-path-variable-shorter-than-three-colons-returns-nil-test 
()
+  "Do not identify path variables with less than three colons."
+  (with-temp-buffer
+    (insert "\"foo:bar:lisp\"")
+    (goto-char 7)
+    (should (not (hpath:at-p)))))
+
 (provide 'hpath-tests)
 ;;; hpath-tests.el ends here



reply via email to

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