diff options
author | Stefan Kangas <stefan@marxist.se> | 2020-10-30 12:48:30 +0100 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2020-10-30 13:23:31 +0100 |
commit | b295174210465c4285729c67ec014e0f5b53f741 (patch) | |
tree | ee29a01828bedfbd902278e953ce38541923add5 /test/lisp/emacs-lisp/text-property-search-tests.el | |
parent | daa21fb895c378674238f0f0a2492d93234901db (diff) | |
download | emacs-b295174210465c4285729c67ec014e0f5b53f741.tar.gz emacs-b295174210465c4285729c67ec014e0f5b53f741.tar.bz2 emacs-b295174210465c4285729c67ec014e0f5b53f741.zip |
Clarify point position after text-property-search
* lisp/emacs-lisp/text-property-search.el
(text-property-search-forward, text-property-search-backward): Doc fix
to clarify placement of point after search.
* test/lisp/emacs-lisp/text-property-search-tests.el
(text-property-search--pos-test): New defun.
(text-property-search-forward-point-at-beginning)
(text-property-search-backward-point-at-end): New test.
Diffstat (limited to 'test/lisp/emacs-lisp/text-property-search-tests.el')
-rw-r--r-- | test/lisp/emacs-lisp/text-property-search-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/text-property-search-tests.el b/test/lisp/emacs-lisp/text-property-search-tests.el index 83d4b95b76b..278155006c2 100644 --- a/test/lisp/emacs-lisp/text-property-search-tests.el +++ b/test/lisp/emacs-lisp/text-property-search-tests.el @@ -153,6 +153,24 @@ 46 57 nil (point-max))) + +;;;; Position after search. + +(defun text-property-search--pos-test (fun pos &optional reverse) + (with-temp-buffer (:name "position") + (insert (concat "foo " + (propertize "bar" 'x t) + " baz")) + (goto-char (if reverse (point-max) (point-min))) + (funcall fun 'x t) + (should (= (point) pos)))) + +(ert-deftest text-property-search-forward-point-at-beginning () + (text-property-search--pos-test #'text-property-search-forward 5)) + +(ert-deftest text-property-search-backward-point-at-end () + (text-property-search--pos-test #'text-property-search-backward 8 t)) + (provide 'text-property-search-tests) ;;; text-property-search-tests.el ends here |