diff options
author | Stefan Kangas <stefan@marxist.se> | 2022-06-29 13:29:27 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2022-06-29 13:54:51 +0200 |
commit | 3c0b18facd0b7e733ec33913da02896b662742c2 (patch) | |
tree | 602983e1d94c1a9aa4a72a893f154f5d2b21206f /test/lisp/emacs-lisp/text-property-search-tests.el | |
parent | f9d35afea37eb3a22ac1301dda431a79b3a34a02 (diff) | |
download | emacs-3c0b18facd0b7e733ec33913da02896b662742c2.tar.gz emacs-3c0b18facd0b7e733ec33913da02896b662742c2.tar.bz2 emacs-3c0b18facd0b7e733ec33913da02896b662742c2.zip |
Make two text-property-search tests easier to read
* test/lisp/emacs-lisp/text-property-search-tests.el
(text-property-search-forward/point-at-beginning)
(text-property-search-backward/point-at-end): Rewrite to make tests
easier to read.
Diffstat (limited to 'test/lisp/emacs-lisp/text-property-search-tests.el')
-rw-r--r-- | test/lisp/emacs-lisp/text-property-search-tests.el | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/test/lisp/emacs-lisp/text-property-search-tests.el b/test/lisp/emacs-lisp/text-property-search-tests.el index d137572f304..98fdd55e85f 100644 --- a/test/lisp/emacs-lisp/text-property-search-tests.el +++ b/test/lisp/emacs-lisp/text-property-search-tests.el @@ -156,20 +156,19 @@ ;;;; Position after search. -(defun text-property-search--pos-test (fun pos &optional reverse) +(ert-deftest text-property-search-forward/point-at-beginning () (with-temp-buffer - (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)) + (insert (concat "1234" (propertize "567" 'x t) "890")) + (goto-char (point-min)) + (text-property-search-forward 'x t) + (should (= (point) 5)))) + +(ert-deftest text-property-search-backward/point-at-end () + (with-temp-buffer + (insert (concat "1234" (propertize "567" 'x t) "890")) + (goto-char (point-max)) + (text-property-search-backward 'x t) + (should (= (point) 8)))) (provide 'text-property-search-tests) |