branch: externals/hyperbole
commit 3b7b755a596afe231a5bf44e44aa78b407e7d560
Author: Mats Lidell <[email protected]>
Commit: GitHub <[email protected]>
Add test for hpath:delimited-possible-path (#813)
---
ChangeLog | 6 ++++++
test/hpath-tests.el | 30 ++++++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4bb8ec596f..25fc917edb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-11-16 Mats Lidell <[email protected]>
+
+* test/hpath-tests.el (hpath--hpath:delimited-possible-path-in-ls-R):
+ Rename test.
+ (hpath--hpath:delimited-possible-path): Add test using the old name.
+
2025-11-16 Bob Weiner <[email protected]>
* test/hywiki-tests.el (hywiki-tests--hkey-help): Rename to
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index a2edccd035..90acf628f0 100644
--- a/test/hpath-tests.el
+++ b/test/hpath-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <[email protected]>
;;
;; Orig-Date: 28-Feb-21 at 23:26:00
-;; Last-Mod: 11-Nov-25 at 16:27:32 by Mats Lidell
+;; Last-Mod: 16-Nov-25 at 23:23:37 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -403,7 +403,7 @@ See `hpath:line-and-column-regexp'."
(should-not (string-match hpath:line-and-column-regexp "/foo/bar.org:LL1"))
(should-not (string-match hpath:line-and-column-regexp "/foo/bar.org:C1")))
-(ert-deftest hpath--hpath:delimited-possible-path ()
+(ert-deftest hpath--hpath:delimited-possible-path-in-ls-R ()
"Verify delimited paths are found in an `ls -R' listing in `shell-mode'."
(let ((files
'(("file1.ext file2.ext file3.ext" ; Space delimited
@@ -453,6 +453,32 @@ dir/subdir:
(should (string= (expand-file-name (concat filename ".ext")
"dir/subdir")
(hpath:delimited-possible-path))))))))))
+(ert-deftest hpath--hpath:delimited-possible-path ()
+ "Verify hpath:delimited-possible-path."
+ ;; text result mode
+ (let ((paths '(("/tmp" "/tmp" text-mode)
+ ("/does-not-exist" "/does-not-exist" text-mode)
+ ("file://file " "file" text-mode)
+ (""'file'"e" "file" text-mode)
+ ("\\\"'file'\\\"" "file" text-mode)
+ ("@file{file}" "file" text-mode)
+ ("\"file\"" "file" text-mode)
+ ("\"'file'\"" "file" text-mode)
+ ("\"`file'\"" "file" text-mode)
+ ("'file'" "file" python-mode)
+ ("'''file'''" "file" python-mode)
+ ("``file''" "file" texinfo-mode))))
+ (dolist (path paths)
+ (let ((text (nth 0 path))
+ (result (nth 1 path))
+ (mode (nth 2 path)))
+ (ert-info ((format "Find path %s in mode: %s" text mode))
+ (with-temp-buffer
+ (funcall mode)
+ (insert (format "%s\n" text))
+ (goto-char (/ (length text) 2))
+ (should (string= result (hpath:delimited-possible-path)))))))))
+
(ert-deftest hpath--to-markup-anchor ()
"Verify `hpath:to-markup-anchor'."
(dolist (v '((text-mode 2) (outline-mode 0)))