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

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

[elpa] externals/hyperbole 93874b2ec3 8/9: test/hbut-tests.el: Change mo


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 93874b2ec3 8/9: test/hbut-tests.el: Change most "/tmp" to "/tmp/"
Date: Mon, 16 Dec 2024 15:58:32 -0500 (EST)

branch: externals/hyperbole
commit 93874b2ec3dd4696ce431b21a8185d52c2d40982
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>

    test/hbut-tests.el: Change most "/tmp" to "/tmp/"
    
    This is to ease comparison with 'default-directory'.
---
 ChangeLog          |  5 ++++
 hywiki.el          | 13 +++++++----
 test/hbut-tests.el | 68 +++++++++++++++++++++++++++---------------------------
 3 files changed, 47 insertions(+), 39 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7c148bcf25..62e81808a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-12-16  Bob Weiner  <rsw@gnu.org>
+
+* test/hbut-tests.el: Change most "/tmp" to "/tmp/" for ease of comparison
+    with 'default-directory'.
+
 2024-12-15  Bob Weiner  <rsw@gnu.org>
 
 * test/hywiki-tests.el (hywiki-tests--action-key-on-wikiword-displays-page):
diff --git a/hywiki.el b/hywiki.el
index 4013881c52..242101f075 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Apr-24 at 22:41:13
-;; Last-Mod:     15-Dec-24 at 18:52:02 by Bob Weiner
+;; Last-Mod:     16-Dec-24 at 01:03:45 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -129,7 +129,7 @@
 (require 'hui-mini)   ;; For `hui:menu-act'
 (require 'hypb)       ;; Requires `seq'
 (require 'outline)    ;; For `outline-mode-syntax-table'
-(require 'subr-x)     ;; For `string-clean-whitespace' and 
`string-remove-prefix'
+(require 'subr-x)     ;; For `string-remove-prefix'
 (require 'thingatpt)
 
 (eval-and-compile
@@ -2297,9 +2297,12 @@ trailing whitespace, and type prefix.  Return nil, if no 
match."
   (when (and (stringp link-str) (not (string-empty-p link-str)))
     (string-remove-prefix
      (concat hywiki-org-link-type ":")
-     (string-trim (car (delete ""
-                              (mapcar #'string-clean-whitespace
-                                      (split-string link-str 
"\\[\\[\\|\\]\\[\\|\\]\\]"))))))))
+     (let ((blank "[[:blank:]\r\n]+"))
+       (string-trim (car (delete ""
+                                (mapcar (lambda (str)
+                                          (string-trim 
(replace-regexp-in-string blank " " str t t)
+                                                       blank blank))
+                                        (split-string link-str 
"\\[\\[\\|\\]\\[\\|\\]\\]")))))))))
 
 ;;;###autoload
 (defun hywiki-tags-view (&optional todo-only match view-buffer-name)
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index 1fb0c4489d..cfdb987113 100644
--- a/test/hbut-tests.el
+++ b/test/hbut-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    30-may-21 at 09:33:00
-;; Last-Mod:     15-Dec-24 at 23:48:34 by Bob Weiner
+;; Last-Mod:     16-Dec-24 at 00:55:21 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -26,10 +26,10 @@
 (require 'hy-test-helpers "test/hy-test-helpers")
 
 (defun hbut-tests:should-match-tmp-folder (tmp)
-  "Check that TMP matches either of \"/tmp\" or \"/private/tmp\".
+  "Check that TMP matches either of \"/tmp/\" or \"/private/tmp/\".
 Needed since hyperbole expands all links to absolute paths and
-/tmp can be a symbolic link."
-  (should (and (stringp tmp) (string-match-p 
"\"?\\(/\\|./\\|/private/\\)tmp\"?\\'" tmp) t)))
+/tmp/ can be a symbolic link."
+  (should (and (stringp tmp) (string-match-p 
"\"?\\(/\\|./\\|/private/\\)tmp/\"?\\'" tmp) t)))
 
 (ert-deftest ebut-program-link-to-directory ()
   "Programatically create ebut with link-to-directory using 
`temporary-file-directory`."
@@ -75,7 +75,7 @@ Create button with link-to-directory using 
`temporary-file-directory`."
     (unwind-protect
         (progn
           (find-file file)
-          (ebut:program "label" 'link-to-directory "/tmp")
+          (ebut:program "label" 'link-to-directory "/tmp/")
           (should (hbut:at-p))
           (should (hui:hbut-delete))
           (should-not (hbut:at-p)))
@@ -84,7 +84,7 @@ Create button with link-to-directory using 
`temporary-file-directory`."
 (ert-deftest ebut-delete-removes-ebut-in-non-file-buffer ()
   "Remove an ebut from non file buffer."
   (with-temp-buffer
-    (ebut:program "label" 'link-to-directory "/tmp")
+    (ebut:program "label" 'link-to-directory "/tmp/")
     (should (hbut:at-p))
     (should (hui:hbut-delete))
     (should-not (hbut:at-p))))
@@ -93,7 +93,7 @@ Create button with link-to-directory using 
`temporary-file-directory`."
   "Remove an ebut from `message-mode' buffer."
   (with-temp-buffer
     (message-mode)
-    (ebut:program "label" 'link-to-directory "/tmp")
+    (ebut:program "label" 'link-to-directory "/tmp/")
     (should (hbut:at-p))
     (should (hui:hbut-delete))
     (should-not (hbut:at-p))))
@@ -105,8 +105,8 @@ Create button with link-to-directory using 
`temporary-file-directory`."
     (unwind-protect
        (with-mock
           (mock (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
-          (mock (ebut:program "label" 'link-to-directory "/tmp") => t)
-          (gbut:ebut-program "label" 'link-to-directory "/tmp"))
+          (mock (ebut:program "label" 'link-to-directory "/tmp/") => t)
+          (gbut:ebut-program "label" 'link-to-directory "/tmp/"))
       (hy-delete-file-and-buffer test-file))))
 
 (ert-deftest gbut-program-link-to-directory ()
@@ -117,7 +117,7 @@ Create button with link-to-directory using 
`temporary-file-directory`."
        (progn
           (with-mock
             (mock (hpath:find-noselect (expand-file-name hbmap:filename 
hbmap:dir-user)) => test-buffer)
-            (gbut:ebut-program "global" 'link-to-directory "/tmp"))
+            (gbut:ebut-program "global" 'link-to-directory "/tmp/"))
          (with-current-buffer test-buffer
             (should (eq (hattr:get (hbut:at-p) 'actype) 
'actypes::link-to-directory))
             (hbut-tests:should-match-tmp-folder (car (hattr:get (hbut:at-p) 
'args)))
@@ -181,7 +181,7 @@ Create button with link-to-directory using 
`temporary-file-directory`."
 (ert-deftest hypb:program-create-ebut-in-buffer ()
   "Create button with hypb:program in buffer."
   (with-temp-buffer
-    (ebut:program "label" 'link-to-directory "/tmp")
+    (ebut:program "label" 'link-to-directory "/tmp/")
     (should (eq (hattr:get (hbut:at-p) 'actype) 'actypes::link-to-directory))
     (hbut-tests:should-match-tmp-folder (car (hattr:get (hbut:at-p) 'args)))
     (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))))
@@ -189,10 +189,10 @@ Create button with link-to-directory using 
`temporary-file-directory`."
 (ert-deftest hypb:program-create-ebut-in-buffer-with-same-label ()
   "Create button with same label shall add number so it is unique."
   (with-temp-buffer
-    (ebut:program "label" 'link-to-directory "/tmp")
+    (ebut:program "label" 'link-to-directory "/tmp/")
     (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))
     (goto-char (point-max))
-    (ebut:program "label" 'link-to-directory "/tmp")
+    (ebut:program "label" 'link-to-directory "/tmp/")
     (goto-char (- (point-max) 2))
     (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label:2"))))
 
@@ -218,8 +218,8 @@ Create button with link-to-directory using 
`temporary-file-directory`."
 (ert-deftest hbut-tests-ibut-program-link-to-directory ()
   "Programmatically create ibut link-to-directory."
   (with-temp-buffer
-    (ibut:program "name" 'link-to-directory "/tmp")
-    (should (string= "<[name]> - \"/tmp\"" (buffer-string)))))
+    (ibut:program "name" 'link-to-directory "/tmp/")
+    (should (string= "<[name]> - \"/tmp/\"" (buffer-string)))))
 
 (ert-deftest hbut-tests-ibut-program-link-to-file ()
   "Programatically create ibut link to file."
@@ -235,14 +235,14 @@ Create button with link-to-directory using 
`temporary-file-directory`."
 (ert-deftest hbut-tests-ibut-insert-text-link-to-dir ()
   "Insert link to dir."
   (with-temp-buffer
-    (ibut:program "name" 'link-to-directory "/tmp")
-    (should (string= "<[name]> - \"/tmp\"" (buffer-string)))
+    (ibut:program "name" 'link-to-directory "/tmp/")
+    (should (string= "<[name]> - \"/tmp/\"" (buffer-string)))
     (goto-char 3)
     (let ((but (ibut:at-p)))
       (should but)
       (with-temp-buffer
         (ibut:insert-text but)
-       ;; Allow for /tmp being a link to /private/tmp on Macos
+       ;; Allow for /tmp/ being a link to /private/tmp/ on Macos
         (should (string-match "\"\\(/private\\)?/tmp/\"" (buffer-string)))))))
 
 (ert-deftest hbut-tests-ibut-insert-annot-bib ()
@@ -375,7 +375,7 @@ Create button with link-to-directory using 
`temporary-file-directory`."
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
     (let (buf-str)
-      (insert "/tmp")
+      (insert "/tmp/")
       (goto-char 2)
       (should (hbut:at-p))
       (should (eq (hattr:get 'hbut:current 'actype) 'actypes::link-to-file))
@@ -400,7 +400,7 @@ See #10 for the proper way to add an ibutton name.
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
     (let (buf-str)
-      (insert "/tmp")
+      (insert "/tmp/")
       (goto-char 2)
       (should (hbut:at-p))
       ;; Test that ibut:operate errors and leaves in-buffer button unchanged
@@ -420,7 +420,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "<[name]> - /tmp")
+    (let ((ibut-str "<[name]> - /tmp/")
          buf-str)
       (insert ibut-str)
       (goto-char 2)
@@ -444,7 +444,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "<[name]> - /tmp")
+    (let ((ibut-str "<[name]> - /tmp/")
          buf-str)
       (insert ibut-str)
       (goto-char 2)
@@ -467,7 +467,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "<[name]> - \"/tmp\"")
+    (let ((ibut-str "<[name]> - \"/tmp/\"")
          buf-str)
       (insert ibut-str)
       (goto-char 2)
@@ -494,7 +494,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "<[name]> - /tmp")
+    (let ((ibut-str "<[name]> - /tmp/")
          buf-str)
       (insert ibut-str "\nabcd")
       (mark-whole-buffer)
@@ -519,7 +519,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "region - /tmp")
+    (let ((ibut-str "region - /tmp/")
          buf-str)
       (insert ibut-str)
       (goto-char (point-min))
@@ -542,7 +542,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "<[abcd]> - \"/tmp\"")
+    (let ((ibut-str "<[abcd]> - \"/tmp/\"")
          buf-str)
       (insert ibut-str)
       (mark-whole-buffer)
@@ -567,7 +567,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "<[name]> - \"/tmp\"")
+    (let ((ibut-str "<[name]> - \"/tmp/\"")
          buf-str)
       (insert ibut-str)
       (goto-char 2)
@@ -591,7 +591,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "/tmp")
+    (let ((ibut-str "/tmp/")
          buf-str)
       (insert ibut-str)
       (goto-char 2)
@@ -616,7 +616,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "\"/tmp\"")
+    (let ((ibut-str "\"/tmp/\"")
          buf-str)
       (insert ibut-str)
       (goto-char 2)
@@ -641,7 +641,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     ;; Create in-buffer and in-memory ibut
-    (let ((ibut-str "<[name]> - \"/tmp\"")
+    (let ((ibut-str "<[name]> - \"/tmp/\"")
          buf-str)
       (insert ibut-str)
       (goto-char 2)
@@ -665,7 +665,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     (let (buf-str)
-      (insert "<[name]> - /tmp")
+      (insert "<[name]> - /tmp/")
       (goto-char 2)
       (should (hbut:at-p))
       (set-mark (point-max))
@@ -686,7 +686,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     (let (buf-str)
-      (insert "<[name]> - /tmp")
+      (insert "<[name]> - /tmp/")
       (goto-char 2)
       (should (hbut:at-p))
       (set-mark (point-max))
@@ -707,7 +707,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     (let (buf-str)
-      (insert "/tmp")
+      (insert "/tmp/")
       (goto-char 2)
       (should (hbut:at-p))
       (set-mark (point-max))
@@ -728,7 +728,7 @@ See #10 for the proper way to add an ibutton name.
   (hattr:clear 'hbut:current)
   (with-temp-buffer
     (let (buf-str)
-      (insert "/tmp")
+      (insert "/tmp/")
       (goto-char 2)
       (should (hbut:at-p))
       (set-mark (point-max))



reply via email to

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