diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-11 13:45:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-11 13:45:58 -0500 |
| commit | dba72c4d24059d2cb5a7896ce9ca1ac67e775699 (patch) | |
| tree | 84bd4f731888982a5d8e946ed06dd5a7179bbc37 /tests/test-custom-buffer-file-copy-link-to-buffer-file.el | |
| parent | 262c45559bcf2574b1f8d754c581040b076f3551 (diff) | |
| download | dotemacs-dba72c4d24059d2cb5a7896ce9ca1ac67e775699.tar.gz dotemacs-dba72c4d24059d2cb5a7896ce9ca1ac67e775699.zip | |
fix(custom-buffer-file): error when copy-link has no file to copy
cj/copy-link-to-buffer-file did nothing in a non-file buffer, while every sibling copy command signals a user-error. The silent no-op gave no feedback either way. Now it signals a user-error too, and I updated the two tests and the commentary that had documented the silence as intended.
Diffstat (limited to 'tests/test-custom-buffer-file-copy-link-to-buffer-file.el')
| -rw-r--r-- | tests/test-custom-buffer-file-copy-link-to-buffer-file.el | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/test-custom-buffer-file-copy-link-to-buffer-file.el b/tests/test-custom-buffer-file-copy-link-to-buffer-file.el index 262968d6..5ee57b3a 100644 --- a/tests/test-custom-buffer-file-copy-link-to-buffer-file.el +++ b/tests/test-custom-buffer-file-copy-link-to-buffer-file.el @@ -4,7 +4,8 @@ ;; Tests for the cj/copy-link-to-buffer-file function from custom-buffer-file.el ;; ;; This function copies the full file:// path of the current buffer's file to -;; the kill ring. For non-file buffers, it does nothing (no error). +;; the kill ring. For non-file buffers, it signals a user-error, matching its +;; sibling copy commands. ;;; Code: @@ -58,12 +59,12 @@ (test-copy-link-teardown))) (ert-deftest test-copy-link-non-file-buffer () - "Should do nothing for non-file buffer without error." + "Error: a non-file buffer signals `user-error' and leaves the kill ring alone." (test-copy-link-setup) (unwind-protect (with-temp-buffer (setq kill-ring nil) - (cj/copy-link-to-buffer-file) + (should-error (cj/copy-link-to-buffer-file) :type 'user-error) (should (null kill-ring))) (test-copy-link-teardown))) @@ -195,13 +196,13 @@ (test-copy-link-teardown))) (ert-deftest test-copy-link-scratch-buffer () - "Should do nothing for *scratch* buffer." + "Error: the *scratch* buffer (no file) signals `user-error'." (test-copy-link-setup) (unwind-protect (progn (setq kill-ring nil) (with-current-buffer "*scratch*" - (cj/copy-link-to-buffer-file) + (should-error (cj/copy-link-to-buffer-file) :type 'user-error) (should (null kill-ring)))) (test-copy-link-teardown))) |
