[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 8133ed63eb 1/9: Add test for hui-kill-region
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 8133ed63eb 1/9: Add test for hui-kill-region |
Date: |
Sun, 19 Jan 2025 12:58:13 -0500 (EST) |
branch: externals/hyperbole
commit 8133ed63eb918811af2fd55e6392fc628512187f
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: Mats Lidell <mats.lidell@lidells.se>
Add test for hui-kill-region
---
ChangeLog | 2 +
test/hui-tests.el | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index f483bb9441..dab3e50ed9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2025-01-09 Mats Lidell <matsl@gnu.org>
+* test/hui-tests.el (hui--kill-region): Test.
+
* test/MANIFEST: Add hycontrol-tests.el
* hycontrol.el (hycontrol-framemove-direction): Quit hycontrol before
diff --git a/test/hui-tests.el b/test/hui-tests.el
index 966547a11f..9b6fae379d 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: 13-Jul-24 at 23:42:26 by Mats Lidell
+;; Last-Mod: 9-Jan-25 at 23:03:37 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -1172,6 +1172,120 @@ With point on label suggest that ibut for rename."
(gbut:act "global"))
(hy-delete-file-and-buffer global-but-file))))
+(ert-deftest hui--kill-region ()
+ "Verify `hui-kill-region'."
+ (with-temp-buffer
+ (transient-mark-mode 1)
+ (insert "123")
+ (goto-char 1)
+
+ ;; No mark set
+ (should-error (hui-kill-region) :type 'error)
+
+ (set-mark (point))
+ (hui-kill-region)
+ (should (looking-at-p "123"))
+
+ (goto-char (point-max))
+ (should (region-active-p))
+ (hui-kill-region)
+ (beginning-of-buffer)
+ (should (string= "" (buffer-string)))
+
+ (insert "123(456)789")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (deactivate-mark)
+ (should-not (region-active-p))
+ (funcall-interactively 'hui-kill-region)
+ (if noninteractive
+ (should (string= "(456)789" (buffer-string)))
+ (should (string= "123789" (buffer-string))))
+
+ (delete-region (point-min) (point-max))
+ (insert "123(456)789")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (should (region-active-p))
+ (funcall-interactively 'hui-kill-region)
+ (should (string= "(456)789" (buffer-string)))
+
+ (delete-region (point-min) (point-max))
+ (insert "123(456)789")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (deactivate-mark)
+ (should-not (region-active-p))
+ (hui-kill-region)
+ (should (string= "(456)789" (buffer-string)))
+
+ (delete-region (point-min) (point-max))
+ (insert "123(456)789")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (should (region-active-p))
+ (hui-kill-region)
+ (should (string= "(456)789" (buffer-string))))
+
+ (with-temp-buffer
+ (transient-mark-mode 0)
+ (insert "123")
+ (goto-char 1)
+
+ ;; No mark set
+ (should-error (hui-kill-region) :type 'error)
+
+ (set-mark (point))
+ (hui-kill-region)
+ (should (looking-at-p "123"))
+
+ (goto-char (point-max))
+ (should-not (region-active-p))
+ (hui-kill-region)
+ (beginning-of-buffer)
+ (should (string= "" (buffer-string)))
+
+ (insert "123(456)789")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (deactivate-mark)
+ (should-not (region-active-p))
+ (funcall-interactively 'hui-kill-region)
+ (should (string= "(456)789" (buffer-string)))
+
+ (delete-region (point-min) (point-max))
+ (insert "123(456)789")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (should-not (region-active-p))
+ (funcall-interactively 'hui-kill-region)
+ (should (string= "(456)789" (buffer-string)))
+
+ (delete-region (point-min) (point-max))
+ (insert "123(456)789")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (deactivate-mark)
+ (should-not (region-active-p))
+ (hui-kill-region)
+ (should (string= "(456)789" (buffer-string)))
+
+ (delete-region (point-min) (point-max))
+ (insert "123(456)789")
+ (goto-char 1)
+ (set-mark (point))
+ (goto-char 4)
+ (should-not (region-active-p))
+ (hui-kill-region)
+ (should (string= "(456)789" (buffer-string)))))
+
;; This file can't be byte-compiled without `with-simulated-input' which
;; is not part of the actual dependencies, so:
;; Local Variables:
- [elpa] externals/hyperbole updated (cbbf963a9f -> bb7909e5d6), ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 1752acb9d0 3/9: Use prefix arg for interactive call, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 99ae350431 2/9: Refactored and simplified, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 8133ed63eb 1/9: Add test for hui-kill-region,
ELPA Syncer <=
- [elpa] externals/hyperbole a7ba7d86ea 5/9: Fix non-interactive behavior, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 436eb33439 6/9: Add test for consecutive calls to hui-kill-region, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole f423dd3163 4/9: Refactor to have base behavior as kill-region, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 30daecc280 8/9: Merge branch 'master' into add-test-for-c-w-use-prefix-arg, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole bb7909e5d6 9/9: Merge pull request #646 from rswgnu/add-test-for-c-w-use-prefix-arg, ELPA Syncer, 2025/01/19
- [elpa] externals/hyperbole 17a3d87b6e 7/9: Avoid prior tests kill commands to affect kill ring, ELPA Syncer, 2025/01/19