summaryrefslogtreecommitdiff
path: root/test/lisp/help-mode-tests.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-01-16 13:26:10 +0100
committerAndrea Corallo <akrl@sdf.org>2021-01-16 13:26:10 +0100
commit0a7ac0b5504e75275699a3d8d2d5d94bcfda8708 (patch)
treebb6158c8a9edeb1e716718abfc98dca16aef9e9e /test/lisp/help-mode-tests.el
parentf1efac1f9efbfa15b6434ebef507c00c1277633f (diff)
parent0732fc31932c75c682c8b65b4dcb4376ca63e8fd (diff)
downloademacs-0a7ac0b5504e75275699a3d8d2d5d94bcfda8708.tar.gz
emacs-0a7ac0b5504e75275699a3d8d2d5d94bcfda8708.tar.bz2
emacs-0a7ac0b5504e75275699a3d8d2d5d94bcfda8708.zip
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'test/lisp/help-mode-tests.el')
-rw-r--r--test/lisp/help-mode-tests.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/lisp/help-mode-tests.el b/test/lisp/help-mode-tests.el
index e0e82c9cc1a..43db59d4b1b 100644
--- a/test/lisp/help-mode-tests.el
+++ b/test/lisp/help-mode-tests.el
@@ -72,14 +72,19 @@ Lisp concepts such as car, cdr, cons cell and list.")
#'info)))))
(ert-deftest help-mode-tests-xref-button ()
- (with-temp-buffer
- (insert "See also the function ‘interactive’.")
- (string-match help-xref-symbol-regexp (buffer-string))
- (help-xref-button 8 'help-function)
- (should-not (button-at 22))
- (should-not (button-at 35))
- (let ((button (button-at 30)))
- (should (eq (button-type button) 'help-function)))))
+ (let* ((fmt "See also the function ‘%s’.")
+ ;; 1+ translates string index to buffer position.
+ (beg (1+ (string-search "%" fmt))))
+ (with-temp-buffer
+ (dolist (fn '(interactive \` = + - * / %))
+ (erase-buffer)
+ (insert (format fmt fn))
+ (goto-char (point-min))
+ (re-search-forward help-xref-symbol-regexp)
+ (help-xref-button 8 'help-function)
+ (should-not (button-at (1- beg)))
+ (should-not (button-at (+ beg (length (symbol-name fn)))))
+ (should (eq (button-type (button-at beg)) 'help-function))))))
(ert-deftest help-mode-tests-insert-xref-button ()
(with-temp-buffer