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

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

[elpa] externals/hyperbole e0a5d67e8c: Add tests for file names with has


From: ELPA Syncer
Subject: [elpa] externals/hyperbole e0a5d67e8c: Add tests for file names with hash character (#315)
Date: Sat, 8 Apr 2023 17:57:56 -0400 (EDT)

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

    Add tests for file names with hash character (#315)
---
 ChangeLog           |  6 ++++++
 test/hpath-tests.el | 28 +++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 1ae007ed36..5a1b424c05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-08  Mats Lidell  <matsl@gnu.org>
+
+* test/hpath-tests.el (hpath--at-p-checks-files-with-hash-in-name-exists)
+    (hpath--at-p-checks-file-that-with-hash-that-does-not-exist-returns-nil):
+    Add tests for pathnames with hash characters.
+
 2023-04-07  Mats Lidell  <matsl@gnu.org>
 
 * test/hui-tests.el (hui--ibut-create-interactive)
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index 75672f9459..9a216a627c 100644
--- a/test/hpath-tests.el
+++ b/test/hpath-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    28-Feb-21 at 23:26:00
-;; Last-Mod:     12-Sep-22 at 22:11:14 by Mats Lidell
+;; Last-Mod:      8-Apr-23 at 10:16:31 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -258,5 +258,31 @@
       (goto-char 5)
       (should (string= (hpath:remote-at-p) tramp-file)))))
 
+(ert-deftest hpath--at-p-checks-files-with-hash-in-name-exists ()
+  "Verify that file existence is checked for filenames containing a hash 
character."
+  (let ((dir (make-temp-file "hypb" t)))
+    (unwind-protect
+        (dolist (fn '("#file#" "#.file#" "#file path#" "path#section" 
"#path#section"))
+          (let ((filename (expand-file-name fn dir)))
+            (unwind-protect
+                (progn
+                  (find-file filename)
+                  (insert "\"" fn "\"")
+                  (save-buffer)
+                  (goto-char 3)
+                  (should (string= (hpath:at-p) fn))
+                  (should (string= (hpath:is-p fn) fn)))
+              (delete-file filename))))
+      (delete-directory dir))))
+
+(ert-deftest 
hpath--at-p-checks-file-that-with-hash-that-does-not-exist-returns-nil ()
+  "Verify that file existence is checked for filenames containing a hash 
character."
+  (dolist (fn '("#file#" "#.file#" "#file path#" "path#section" 
"#path#section"))
+    (with-temp-buffer
+      (insert "\"" fn "\"")
+      (goto-char 3)
+      (should-not (hpath:at-p))
+      (should-not (hpath:is-p fn)))))
+
 (provide 'hpath-tests)
 ;;; hpath-tests.el ends here



reply via email to

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