[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 027eb85174 014/143: Merge matsl-rsw-hpath-exp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 027eb85174 014/143: Merge matsl-rsw-hpath-expand' into rsw |
Date: |
Mon, 19 Feb 2024 15:58:46 -0500 (EST) |
branch: externals/hyperbole
commit 027eb85174545e332f82ff3d82e6562c5b58e957
Merge: 6550a0ac7c 2f5d06dd4c
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>
Merge matsl-rsw-hpath-expand' into rsw
Fix 'hpath--expand-auto-variable-alist' and
'hpath--resolve-auto-variable-alist' tests.
---
ChangeLog | 9 +++++
hpath.el | 2 +-
test/hpath-tests.el | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 104 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 92cb4d0681..447190c6eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,15 @@
hyrolo.el (hyrolo-file-list): Update doc to specify allowable file suffixes
and types.
+2023-12-23 Mats Lidell <matsl@gnu.org>
+
+* test/hpath-tests.el (hpath--expand-no-wildcards-existing-path)
+ (hpath--expand-variations-non-existing-path)
+ (hpath--expand-elisp-variable, hpath--expand-environment-variable)
+ (hpath--expand-auto-variable-alist, hpath--resolve-auto-variable-alist)
+ (hpath--expand-list-return-a-list, hpath--expand-list-match-regexp):
+ Add tests for hpath:expand and hpath:expand-list.
+
2023-12-23 Bob Weiner <rsw@gnu.org>
* hypb.el (hypb:major-mode-from-file-name): Add for initial use in "hyrolo.el".
diff --git a/hpath.el b/hpath.el
index eabe439456..e22171d80c 100644
--- a/hpath.el
+++ b/hpath.el
@@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 1-Nov-91 at 00:44:23
-;; Last-Mod: 16-Dec-23 at 16:47:24 by Bob Weiner
+;; Last-Mod: 17-Dec-23 at 23:01:29 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index afd29b3fe0..9a16799fdb 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: 14-Nov-23 at 00:35:22 by Bob Weiner
+;; Last-Mod: 17-Dec-23 at 19:35:06 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -285,5 +285,98 @@
(should-not (hpath:at-p))
(should-not (hpath:is-p fn)))))
+(ert-deftest hpath--expand-no-wildcards-existing-path ()
+ "Verify expand with no wildcards gives path back."
+ (let ((file (make-temp-file "hypb")))
+ (unwind-protect
+ (should (string= (hpath:expand file) file))
+ (hy-delete-file-and-buffer file))))
+
+(ert-deftest hpath--expand-variations-non-existing-path ()
+ "Verify expand non existing paths."
+ (should (string= (hpath:expand "/not/existing/file") "/not/existing/file"))
+ (should-not (hpath:expand "/not/existing/file" t))
+ (should (string= (hpath:expand "/not/existing/file*" t)
"/not/existing/file*"))
+ (should (string= (hpath:expand "/not/existing/file[]" t)
"/not/existing/file[]"))
+ (should (string= (hpath:expand "/not/existing/file?" t)
"/not/existing/file?")))
+
+(ert-deftest hpath--expand-elisp-variable ()
+ "Verify an elisp ${variable} is expanded."
+ (let ((hyperb-no-trailing-slash (substring hyperb:dir 0 -1)))
+ (should (string= (hpath:expand "${hyperb:dir}") hyperb-no-trailing-slash))
+ (should (string= (hpath:expand "${hyperb:dir}" t)
hyperb-no-trailing-slash))
+ (should (string= (hpath:expand "${hyperb:dir}/notexisting")
"${hyperb:dir}/notexisting"))
+ (should-not (hpath:expand "${hyperb:dir}/notexisting" t))))
+
+(ert-deftest hpath--expand-environment-variable ()
+ "Verify that a $VAR environment is expanded."
+ (let ((envvar "hpath_test"))
+ (unwind-protect
+ (progn
+ (setenv "HPATH" envvar)
+ (should (string= (hpath:expand "$HPATH") envvar))
+ ; Should next not work? See below where is works
+ ;(should (string= (hpath:expand "${HPATH}") envvar))
+ (should-not (hpath:expand "$HPATH" t))
+ (should-not (hpath:expand "${HPATH}" t)))
+ (setenv "HPATH")))
+ (let ((file (make-temp-file "hypb")))
+ (unwind-protect
+ (progn
+ (setenv "HPATH" file)
+ (should (string= (hpath:expand "$HPATH") file))
+ (should (string= (hpath:expand "${HPATH}") file))
+ (should (string= (hpath:expand "$HPATH" t) file))
+ (should (string= (hpath:expand "${HPATH}" t) file)))
+ (setenv "HPATH")
+ (hy-delete-file-and-buffer file))))
+
+(ert-deftest hpath--expand-auto-variable-alist ()
+ "Verify relative paths matching auto-variable-alist are expanded."
+ (let ((hpath:auto-variable-alist '(("\\.el" . load-path))))
+ (should (string= (hpath:expand "dired.el")
+ (locate-library "dired.el")))
+ (should (string= (hpath:expand "dired.elc")
+ (hpath:resolve "dired.elc")))))
+
+(ert-deftest hpath--resolve-auto-variable-alist ()
+ "Verify relative paths matching auto-variable-alist are resolved."
+ (let ((hpath:auto-variable-alist '(("\\.el" . load-path))))
+ (should (string= (hpath:resolve "dired.el")
+ (locate-library "dired.el")))
+ (should (string= (hpath:resolve "dired.elc")
+ (hpath:expand "dired.elc")))))
+
+(ert-deftest hpath--expand-list-return-a-list ()
+ "Verify expand-list should return a list of paths."
+ (let ((file (make-temp-file "hypb")))
+ (unwind-protect
+ (progn
+ (should (equal (hpath:expand-list '("/file1")) '("/file1")))
+ (should (equal (hpath:expand-list '("/file1") ".*" t) '()))
+ (should (equal (hpath:expand-list (list file)) (list file)))
+ (should (equal (hpath:expand-list (list file) ".*" t) (list file)))
+ (should (equal (hpath:expand-list '("/file1" "/file2")) '("/file1"
"/file2")))
+ (should (equal (hpath:expand-list (list "/file1" file)) (list
"/file1" file)))
+ (should (equal (hpath:expand-list (list "/file1" file) ".*" t) (list
file))))
+ (hy-delete-file-and-buffer file))))
+
+(ert-deftest hpath--expand-list-match-regexp ()
+ "Verify expand-list selects files using match regexp."
+ (let* ((temporary-file-directory (make-temp-file "hypb" t))
+ (org1-file (make-temp-file "hypb" nil ".org"))
+ (org2-file (make-temp-file "hypb" nil ".org"))
+ (kotl-file (make-temp-file "hypb" nil ".kotl")))
+ (unwind-protect
+ (progn
+ (should (= (length (hpath:expand-list (list
temporary-file-directory))) 3))
+ (should (= (length (hpath:expand-list (list
temporary-file-directory) ".*")) 3))
+ (should (= (length (hpath:expand-list (list
temporary-file-directory) ".org")) 2))
+ (should (= (length (hpath:expand-list (list
temporary-file-directory) ".kotl")) 1))
+ (should (= (length (hpath:expand-list (list
temporary-file-directory) ".md")) 0)))
+ (dolist (f (list org1-file org2-file kotl-file))
+ (hy-delete-file-and-buffer f))
+ (delete-directory temporary-file-directory))))
+
(provide 'hpath-tests)
;;; hpath-tests.el ends here
- [elpa] externals/hyperbole 2173bf7e09 002/143: Add new HYPERAMP.org talk slides and update talks in HY-TALK, (continued)
- [elpa] externals/hyperbole 2173bf7e09 002/143: Add new HYPERAMP.org talk slides and update talks in HY-TALK, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 339c6a2a8d 005/143: Fixes for handling outline-regexp and hyrolo-entry-regexp, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 97111e4bd0 004/143: Merge branch 'master' into rsw, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 1f942eac01 008/143: Fix HyRolo {n} and {p} movement commands, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole ca3cf8e427 017/143: hyrolo.el - Fix {t} and {o} commands, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole bc0c5b9086 044/143: HyRolo - if hyrolo-file-list is set on load, initialize its cache, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 1f45b45af9 047/143: Add hyrolo-get-file-list tests, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 38110ee8f7 065/143: Makefile - Change running of ert tests from interactively to batch, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 407114d7f3 070/143: Run tests in batch mode specified by selector, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 926f8a02fd 010/143: Fix many hyrolo multi-file-format issues; fix hywconfig by name, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 027eb85174 014/143: Merge matsl-rsw-hpath-expand' into rsw,
ELPA Syncer <=
- [elpa] externals/hyperbole a7a5723712 015/143: Fix 'hpath--expand-list-match-regexp' test., ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 54d7ae565a 020/143: Complete test suite for hui:link-possible-types, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 12950cd2db 029/143: Matsl rsw fix failing tests (#424), ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 98edfae8d1 021/143: Fix test with link-to-string-match since bug is fixed, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 966605b7a3 028/143: hkey-window-link, {M-o w} - invert the meaning of prefix arg, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 7adb441c0e 036/143: kotl-mode - fix kill and yank commands not moving to valid pos first, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 2187b3522b 049/143: Add test for hiding and showing, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole e995fc8905 050/143: Add test for moving between two sections, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole 7657601745 043/143: hyrolo-mode-map - bind {n} and {C-c C-n} to the same command, ELPA Syncer, 2024/02/19
- [elpa] externals/hyperbole e67d0f733f 058/143: Fix edebugging of tests that have not been previously defined, ELPA Syncer, 2024/02/19