diff options
| author | Jim Porter | 2023-10-25 15:24:28 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-11-11 21:40:12 -0800 |
| commit | e5ba52ad72d0e44b905d6dc321f1e6234491df53 (patch) | |
| tree | 2e8941200b05939fce5b7f123d502ffde8693000 /test | |
| parent | e56e9c19545f43c35dec85fa650f3799c6e9c308 (diff) | |
| download | emacs-e5ba52ad72d0e44b905d6dc321f1e6234491df53.tar.gz emacs-e5ba52ad72d0e44b905d6dc321f1e6234491df53.zip | |
Hook 'bug-reference-mode' up to 'thing-at-point'
* lisp/progmodes/bug-reference.el (bug-reference--url-at-point): New
function.
(bug-reference-mode, bug-reference-prog-mode): Factor initialization
code out to...
(bug-reference--init): ... here.
* test/lisp/progmodes/bug-reference-tests.el (test-thing-at-point):
New test.
* etc/NEWS: Announce this change (bug#66752).
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/bug-reference-tests.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lisp/progmodes/bug-reference-tests.el b/test/lisp/progmodes/bug-reference-tests.el index 790582aed4c..e5b207748bf 100644 --- a/test/lisp/progmodes/bug-reference-tests.el +++ b/test/lisp/progmodes/bug-reference-tests.el | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | (require 'bug-reference) | 26 | (require 'bug-reference) |
| 27 | (require 'ert) | 27 | (require 'ert) |
| 28 | (require 'ert-x) | ||
| 28 | 29 | ||
| 29 | (defun test--get-github-entry (url) | 30 | (defun test--get-github-entry (url) |
| 30 | (and (string-match | 31 | (and (string-match |
| @@ -125,4 +126,18 @@ | |||
| 125 | (test--get-gitea-entry "https://gitea.com/magit/magit/") | 126 | (test--get-gitea-entry "https://gitea.com/magit/magit/") |
| 126 | "magit/magit"))) | 127 | "magit/magit"))) |
| 127 | 128 | ||
| 129 | (ert-deftest test-thing-at-point () | ||
| 130 | "Ensure that (thing-at-point 'url) returns the bug URL." | ||
| 131 | (ert-with-test-buffer (:name "thingatpt") | ||
| 132 | (setq-local bug-reference-url-format "https://debbugs.gnu.org/%s") | ||
| 133 | (insert "bug#1234") | ||
| 134 | (bug-reference-mode) | ||
| 135 | (jit-lock-fontify-now (point-min) (point-max)) | ||
| 136 | (goto-char (point-min)) | ||
| 137 | ;; Make sure we get the URL when `bug-reference-mode' is active... | ||
| 138 | (should (equal (thing-at-point 'url) "https://debbugs.gnu.org/1234")) | ||
| 139 | (bug-reference-mode -1) | ||
| 140 | ;; ... and get nil when `bug-reference-mode' is inactive. | ||
| 141 | (should-not (thing-at-point 'url)))) | ||
| 142 | |||
| 128 | ;;; bug-reference-tests.el ends here | 143 | ;;; bug-reference-tests.el ends here |