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

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

[elpa] externals/hyperbole 025abc4b35 2/2: Merge branch 'master' of hype


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 025abc4b35 2/2: Merge branch 'master' of hyperbole
Date: Mon, 1 May 2023 11:02:59 -0400 (EDT)

branch: externals/hyperbole
commit 025abc4b35291a63476fd7924e5c68ddb38df597
Merge: 810ee4ce5b 39fe175120
Author: Robert Weiner <rsw@gnu.org>
Commit: Robert Weiner <rsw@gnu.org>

    Merge branch 'master' of hyperbole
---
 ChangeLog          |  9 ++++++++
 test/hbut-tests.el | 10 ++++++++-
 test/hui-tests.el  | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ed3bf22ccc..42d1ba3d81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-04-30  Mats Lidell  <matsl@gnu.org>
+
+* test/hui-tests.el (hui--ebut-rename)
+    (hui--ebut-rename-only-button-with-that-label)
+    (hui--ebut-rename-nonumbered-label, hui--ebut-rename-numbered-label)
+    (hui--ebut-rename-all-copies)
+  test/hbut-tests.el (hypb:program-create-ebut-in-buffer-with-same-label):
+    Tests for ebut label rename.
+
 2023-04-30  Bob Weiner  <rsw@gnu.org>
 
 * hsys-www.el (require 'eww): Add.
diff --git a/test/hbut-tests.el b/test/hbut-tests.el
index 21fcb55a95..c8900de5f5 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:      9-Apr-23 at 00:55:07 by Mats Lidell
+;; Last-Mod:     30-Apr-23 at 11:04:33 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -163,6 +163,14 @@ Needed since hyperbole expands all links to absolute paths 
and
     (hbut-tests:should-match-tmp-folder (hattr:get (hbut:at-p) 'args))
     (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))))
 
+(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")
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))
+    (ebut:program "label" 'link-to-directory "/tmp")
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label:2"))))
+
 (ert-deftest hypb:program-create-link-to-file-line-and-column-but-in-file ()
   "Create button that links to file with line and column with hypb:program in 
buffer."
   (let ((test-file (make-temp-file "test-file")))
diff --git a/test/hui-tests.el b/test/hui-tests.el
index 73f59241e6..838885a2d7 100644
--- a/test/hui-tests.el
+++ b/test/hui-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    30-Jan-21 at 12:00:00
-;; Last-Mod:      7-Apr-23 at 12:19:58 by Mats Lidell
+;; Last-Mod:     30-Apr-23 at 17:51:22 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -639,6 +639,66 @@ With point on label suggest that ibut for rename."
            (should-error (hui:ibut-rename "notalabel") :type 'error)))
       (delete-file file))))
 
+(ert-deftest hui--ebut-rename ()
+  "Rename an ebut shall change the name."
+  (with-temp-buffer
+    (ebut:program "label" 'link-to-directory "/tmp")
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))
+    (hui:ebut-rename "label" "new")
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "new"))))
+
+(ert-deftest hui--ebut-rename-only-button-with-that-label ()
+  "Rename an ebut shall change the name of only button with that label."
+  (with-temp-buffer
+    (ebut:program "label" 'link-to-directory "/tmp")
+    (goto-char (point-max))
+    (ebut:program "label2" 'link-to-directory "/tmp")
+    (goto-char (point-min))
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))
+    (hui:ebut-rename "label" "new")
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "new"))
+    (goto-char (- (point-max) 1))
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label2"))))
+
+(ert-deftest hui--ebut-rename-nonumbered-label ()
+  "Rename an ebut shall rename the label with no number."
+  (with-temp-buffer
+    (ebut:program "label" 'link-to-directory "/tmp")
+    (goto-char (point-max))
+    (ebut:program "label" 'link-to-directory "/tmp")
+    (goto-char (point-min))
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))
+    (hui:ebut-rename "label" "new")
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "new"))
+    (goto-char (- (point-max) 1))
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label:2"))))
+
+(ert-deftest hui--ebut-rename-numbered-label ()
+  "Rename an ebut shall rename the label with number."
+  (with-temp-buffer
+    (ebut:program "label" 'link-to-directory "/tmp")
+    (goto-char (point-max))
+    (ebut:program "label" 'link-to-directory "/tmp")
+    (goto-char (- (point-max) 1))
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label:2"))
+    (hui:ebut-rename "label:2" "new")
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "new"))
+    (goto-char (point-min))
+    (should (equal (hattr:get (hbut:at-p) 'lbl-key) "label"))))
+
+(ert-deftest hui--ebut-rename-all-copies ()
+  "Rename an ebut shall rename all copies."
+  (with-temp-buffer
+    (ebut:program "label" 'link-to-directory "/tmp")
+    (end-of-line)
+    (hui-kill-ring-save (point-min) (point))
+    (yank)
+    (goto-char (point-min))
+    (should (looking-at-p "<(label)><(label)>"))
+    (hui:ebut-rename "label" "new")
+    (goto-char (point-min))
+    (should (looking-at-p "<(new)><(new)>"))))
+
 ;; This file can't be byte-compiled without `with-simulated-input' which
 ;; is not part of the actual dependencies, so:
 ;;   Local Variables:



reply via email to

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