[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole ea1369d45c 5/5: Merge Mats latest changes fro
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole ea1369d45c 5/5: Merge Mats latest changes from master |
Date: |
Sun, 9 Apr 2023 10:58:00 -0400 (EDT) |
branch: externals/hyperbole
commit ea1369d45c7984e477905c4b9a78515ee3ed0d98
Merge: e05fda2124 e0a5d67e8c
Author: Robert Weiner <rsw@gnu.org>
Commit: Robert Weiner <rsw@gnu.org>
Merge Mats latest changes from master
---
ChangeLog | 16 ++++++++++
test/hpath-tests.el | 28 +++++++++++++++-
test/hui-tests.el | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 134 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 61c5a18983..432a22b584 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,22 @@
* hyrolo.el (hyrolo-isearch-regexp): Fix 'arg' conditions were reversed.
+2023-04-08 Mats Lidell <matsl@gnu.org>
+
+* test/hpath-tests.el (hpath--at-p-checks-files-with-hash-in-name-exists)
+ (hpath--at-p-checks-file-that-with-hash-that-does-not-exist-returns-nil):
+ Add tests for pathnames with hash characters.
+
+2023-04-07 Mats Lidell <matsl@gnu.org>
+
+* test/hui-tests.el (hui--ibut-create-interactive)
+ (hui--ibut-create-interactive-label-using-region)
+ (hui--ibut-create-interactive-add-comment-char)
+ (hui--ibut-create-interactive-create-label)
+ (hui--ibut-rename-label-at-point, hui--ibut-rename-label)
+ (hui--ibut-rename-label-not-in-buffer-errors): Add tests for ibut with
+ labels.
+
2023-04-07 Bob Weiner <rsw@gnu.org>
* kotl/kimport.el (kimport:suffix-alist): Change car of alist items from
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index 75672f9459..9a216a627c 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: 12-Sep-22 at 22:11:14 by Mats Lidell
+;; Last-Mod: 8-Apr-23 at 10:16:31 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -258,5 +258,31 @@
(goto-char 5)
(should (string= (hpath:remote-at-p) tramp-file)))))
+(ert-deftest hpath--at-p-checks-files-with-hash-in-name-exists ()
+ "Verify that file existence is checked for filenames containing a hash
character."
+ (let ((dir (make-temp-file "hypb" t)))
+ (unwind-protect
+ (dolist (fn '("#file#" "#.file#" "#file path#" "path#section"
"#path#section"))
+ (let ((filename (expand-file-name fn dir)))
+ (unwind-protect
+ (progn
+ (find-file filename)
+ (insert "\"" fn "\"")
+ (save-buffer)
+ (goto-char 3)
+ (should (string= (hpath:at-p) fn))
+ (should (string= (hpath:is-p fn) fn)))
+ (delete-file filename))))
+ (delete-directory dir))))
+
+(ert-deftest
hpath--at-p-checks-file-that-with-hash-that-does-not-exist-returns-nil ()
+ "Verify that file existence is checked for filenames containing a hash
character."
+ (dolist (fn '("#file#" "#.file#" "#file path#" "path#section"
"#path#section"))
+ (with-temp-buffer
+ (insert "\"" fn "\"")
+ (goto-char 3)
+ (should-not (hpath:at-p))
+ (should-not (hpath:is-p fn)))))
+
(provide 'hpath-tests)
;;; hpath-tests.el ends here
diff --git a/test/hui-tests.el b/test/hui-tests.el
index 1d9e6b379e..73f59241e6 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-Mar-23 at 19:22:30 by Bob Weiner
+;; Last-Mod: 7-Apr-23 at 12:19:58 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -549,6 +549,96 @@ Ensure modifying the button but keeping the label does not
create a double label
(should-error (hui-kill-ring-save (region-beginning) (region-end))
:type 'error))
(delete-file kotl-file))))
+(ert-deftest hui--ibut-create-interactive ()
+ "Create an implicit button interactively."
+ (let ((file (make-temp-file "hypb" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (with-simulated-input "ibut RET link-to-rfc RET 123 RET"
+ (hact (lambda () (call-interactively 'hui:ibut-create))))
+ (should (string= "<[ibut]> - rfc123" (buffer-string))))
+ (delete-file file))))
+
+(ert-deftest hui--ibut-create-interactive-label-using-region ()
+ "Create an implicit button interactively with label from region."
+ (let ((file (make-temp-file "hypb" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (insert "ibut")
+ (set-mark (point-min))
+ (goto-char (point-max))
+ (with-simulated-input "RET link-to-rfc RET 123 RET"
+ (hact (lambda () (call-interactively 'hui:ibut-create))))
+ (should (string= "<[ibut]> - rfc123" (buffer-string))))
+ (delete-file file))))
+
+(ert-deftest hui--ibut-create-interactive-add-comment-char ()
+ "Create an implicit button interactively in program mode adds comment char."
+ (let ((file (make-temp-file "hypb" nil ".el"))
+ (auto-insert nil))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (insert "(sexp)")
+ (with-simulated-input "ibut RET link-to-rfc RET 123 RET"
+ (hact (lambda () (call-interactively 'hui:ibut-create))))
+ (should (string= "(sexp); <[ibut]> - rfc123" (buffer-string))))
+ (delete-file file))))
+
+(ert-deftest hui--ibut-create-interactive-create-label ()
+ "Create a label for an implicit button interactively."
+ (let ((file (make-temp-file "hypb" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (insert "\"/tmp\"")
+ (goto-char 3)
+ (with-simulated-input "label RET"
+ (hact (lambda () (call-interactively 'hui:ibut-label-create))))
+ (should (string= "<[label]> - \"/tmp\"" (buffer-string))))
+ (delete-file file))))
+
+(ert-deftest hui--ibut-rename-label-at-point ()
+ "Rename a label for an implicit button interactively.
+With point on label suggest that ibut for rename."
+ (let ((file (make-temp-file "hypb" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (insert "<[label]> - rfc123")
+ (goto-char 3)
+ (with-simulated-input "M-DEL renamed RET"
+ (hact (lambda () (call-interactively 'hui:ibut-rename))))
+ (should (string= "<[renamed]> - rfc123" (buffer-string))))
+ (delete-file file))))
+
+(ert-deftest hui--ibut-rename-label ()
+ "Rename a label for an implicit button interactively."
+ (let ((file (make-temp-file "hypb" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (insert "<[label]> - rfc123")
+ (goto-char (point-max))
+ (with-simulated-input "label RET M-DEL renamed RET"
+ (hact (lambda () (call-interactively 'hui:ibut-rename))))
+ (should (string= "<[renamed]> - rfc123" (buffer-string))))
+ (delete-file file))))
+
+(ert-deftest hui--ibut-rename-label-not-in-buffer-errors ()
+ "Rename a label not in buffer should error."
+ (let ((file (make-temp-file "hypb" nil ".txt")))
+ (unwind-protect
+ (progn
+ (find-file file)
+ (insert "<[label]> - rfc123")
+ (goto-char (point-max))
+ (with-simulated-input "RET"
+ (should-error (hui:ibut-rename "notalabel") :type 'error)))
+ (delete-file file))))
+
;; This file can't be byte-compiled without `with-simulated-input' which
;; is not part of the actual dependencies, so:
;; Local Variables: