Commit e6608010 authored by Noam Postavsky's avatar Noam Postavsky

; Add thing-at-point-looking-at test (Bug#35708)

* test/lisp/thingatpt-tests.el (thing-at-point-looking-at): New test.
parent f5b48469
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
;;; Code: ;;; Code:
(require 'ert) (require 'ert)
(require 'thingatpt)
(defvar thing-at-point-test-data (defvar thing-at-point-test-data
'(("https://1.gnu.org" 1 url "https://1.gnu.org") '(("https://1.gnu.org" 1 url "https://1.gnu.org")
...@@ -131,4 +132,15 @@ position to retrieve THING.") ...@@ -131,4 +132,15 @@ position to retrieve THING.")
(goto-char 23) (goto-char 23)
(should (equal (thing-at-point 'url) "http://foo/bar(baz)")))) (should (equal (thing-at-point 'url) "http://foo/bar(baz)"))))
(ert-deftest thing-at-point-looking-at ()
(with-temp-buffer
(insert "1abcd 2abcd 3abcd")
(goto-char (point-min))
(let ((m2 (progn (search-forward "2abcd")
(match-data))))
(goto-char (point-min))
(search-forward "2ab")
(should (thing-at-point-looking-at "2abcd"))
(should (equal (match-data) m2)))))
;;; thingatpt.el ends here ;;; thingatpt.el ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment