From 5470990f79936fd141dcfd68824ea720dfb48d35 Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Mon, 11 May 2026 16:41:49 +0200 Subject: [PATCH 1/4] Test error case of hyrolo-mail-to * test/hyrolo-tests.el (hyrolo-tests--mail-to): Add test of error case. --- test/hyrolo-tests.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el index 734affcc..ac99cfaf 100644 --- a/test/hyrolo-tests.el +++ b/test/hyrolo-tests.el @@ -1671,7 +1671,12 @@ body (mocklet (((actypes::link-to-compose-mail "second@receiver.org") => t)) (hyrolo-mail-to))) (kill-buffer hyrolo-display-buffer) - (hy-delete-files-and-buffers hyrolo-file-list)))) + (hy-delete-files-and-buffers hyrolo-file-list))) + (with-temp-buffer + (mocklet (((beep) => t)) + (ert-with-message-capture cap + (hyrolo-mail-to) + (hy-test-helpers:should-last-message "Invalid buffer or no e-mail address found" cap))))) (ert-deftest hyrolo-tests--location-movement () "Verify movement between location headers." From 16a51fc0b594fc9dc2e6b7ccac41012118938fa4 Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Mon, 11 May 2026 23:13:10 +0200 Subject: [PATCH 2/4] Add hyrolo-rename test * test/hyrolo-tests.el (hyrolo-tests--rename): Add test. --- test/hyrolo-tests.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el index ac99cfaf..818ca206 100644 --- a/test/hyrolo-tests.el +++ b/test/hyrolo-tests.el @@ -2099,6 +2099,27 @@ Dependencies on the consult package are mocked." (hyrolo-set-date) (should (string= "* item\n\t\t\t2025-01-03\n\n\n" (buffer-string)))))))) +(ert-deftest hyrolo-tests--rename () + "Verify `hyrolo-rename' changes the name of the file." + (defvar new-file) + (let* ((old-file (make-temp-file "hypb" nil ".otl" "old-file")) + (old-file-backup (concat old-file "~")) + (new-file (concat (expand-file-name (make-temp-name "hypb") "/tmp") ".otl")) + (new-file-backup (concat new-file "~"))) + (unwind-protect + (with-mock + (mock (hyrolo-get-file-list) => (list new-file)) + (mock (hyrolo-prompt 'y-or-n-p *) => t) + (make-empty-file old-file-backup) + (find-file-noselect old-file) + (ert-with-message-capture cap + (hyrolo-rename old-file new-file) + (should (string-search "Your personal rolo file is now" cap))) + (should (file-exists-p new-file-backup)) + (with-current-buffer (find-file new-file) + (should (looking-at-p "old-file")))) + (hy-delete-files-and-buffers (list old-file old-file-backup new-file new-file-backup))))) + (provide 'hyrolo-tests) ;; This file can't be byte-compiled without the `el-mock' package From cbbc1ec8f95b7d0b6ee2bf28669f17337beba949 Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Mon, 11 May 2026 23:46:03 +0200 Subject: [PATCH 3/4] Add ChangeLog --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2ffbec98..b5be0527 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2026-05-11 Mats Lidell +* test/hyrolo-tests.el (hyrolo-tests--mail-to): Test error case. + (hyrolo-tests--rename): Add test. + * test/hyrolo-tests.el: Verify all return values for hyrolo-grep and hyrolo-fgrep. From 00aef1165367501ce9b1bf83ce472ecc6d34df8d Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Mon, 11 May 2026 23:56:59 +0200 Subject: [PATCH 4/4] Improve docstring --- test/hyrolo-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el index 818ca206..4234552e 100644 --- a/test/hyrolo-tests.el +++ b/test/hyrolo-tests.el @@ -2100,7 +2100,7 @@ Dependencies on the consult package are mocked." (should (string= "* item\n\t\t\t2025-01-03\n\n\n" (buffer-string)))))))) (ert-deftest hyrolo-tests--rename () - "Verify `hyrolo-rename' changes the name of the file." + "Verify `hyrolo-rename' changes the name of the old rolo file." (defvar new-file) (let* ((old-file (make-temp-file "hypb" nil ".otl" "old-file")) (old-file-backup (concat old-file "~"))