aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJuri Linkov2025-04-29 19:41:44 +0300
committerJuri Linkov2025-04-29 19:41:44 +0300
commit9d0595d8795fbd604c6429317daff4d6445f8904 (patch)
tree052d429fddaa6a0ea2a7a9b41cff7beb0dddb6d3 /test
parent622825995204b7aae70b836c8e5e5d44385c401b (diff)
downloademacs-9d0595d8795fbd604c6429317daff4d6445f8904.tar.gz
emacs-9d0595d8795fbd604c6429317daff4d6445f8904.zip
Fix invalid search bound in 'search-within-boundaries'.
* lisp/isearch.el (search-within-boundaries): Don't go over BOUND. * test/lisp/isearch-tests.el (isearch--test-search-within-boundaries): Test with the BOUND arg as well (bug#78116).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/isearch-tests.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/lisp/isearch-tests.el b/test/lisp/isearch-tests.el
index 301108afbe4..3b2c070d003 100644
--- a/test/lisp/isearch-tests.el
+++ b/test/lisp/isearch-tests.el
@@ -247,7 +247,29 @@
247 (dolist (pos (append (reverse pairs) nil)) 247 (dolist (pos (append (reverse pairs) nil))
248 (should (eq (car pos) (isearch-search-string "foo$" nil t))) 248 (should (eq (car pos) (isearch-search-string "foo$" nil t)))
249 (should (equal (match-string 0) "foo")) 249 (should (equal (match-string 0) "foo"))
250 (when (cdr pos) (should (eq (cdr pos) (match-end 0))))))) 250 (when (cdr pos) (should (eq (cdr pos) (match-end 0))))))
251
252 ;; With BOUND arg (bug#78116)
253 (goto-char (point-min))
254 (let ((isearch-forward t)
255 (isearch-regexp nil)
256 (pos (car pairs)))
257 (should (eq (cdr pos) (isearch-search-string "foo" (cdr pos) t)))
258 (should (eq nil (isearch-search-string "foo" (cdr pos) t)))
259 ;; Start on the text property inside boundaries
260 (forward-char -1)
261 (should (eq nil (isearch-search-string "foo" (cdr pos) t))))
262
263 ;; With BOUND arg (bug#78116)
264 (goto-char (point-max))
265 (let ((isearch-forward nil)
266 (isearch-regexp nil)
267 (pos (car (last pairs))))
268 (should (eq (car pos) (isearch-search-string "foo" (car pos) t)))
269 (should (eq nil (isearch-search-string "foo" (car pos) t)))
270 ;; Start on the text property inside boundaries
271 (forward-char 1)
272 (should (eq nil (isearch-search-string "foo" (car pos) t)))))
251 273
252(ert-deftest isearch--test-search-fun-in-text-property () 274(ert-deftest isearch--test-search-fun-in-text-property ()
253 (let* ((pairs '((4 . 7) (11 . 14) (21 . 24))) 275 (let* ((pairs '((4 . 7) (11 . 14) (21 . 24)))