aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhilipp Stephani2017-06-15 11:49:56 +0200
committerPhilipp Stephani2017-06-16 18:06:28 +0200
commit3b6e01cccf89ba0f3485751125f43463bc429345 (patch)
tree439adae70db311405f2abd6369ad75004eb2eca4 /test
parentea196ebb93188b0962f478f5dec0ff0645c4da10 (diff)
downloademacs-3b6e01cccf89ba0f3485751125f43463bc429345.tar.gz
emacs-3b6e01cccf89ba0f3485751125f43463bc429345.zip
Correctly detect URLs surrounded by parentheses in comments
* lisp/thingatpt.el (thing-at-point--bounds-of-well-formed-url): Make parentheses match work inside comments. * test/lisp/thingatpt-tests.el (thing-at-point-url-in-comment): Add unit test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/thingatpt-tests.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index d4449eacbf9..128534264e5 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -120,4 +120,13 @@ position to retrieve THING.")
120 (should (equal (list-at-point) 120 (should (equal (list-at-point)
121 (cdr str-res))))))) 121 (cdr str-res)))))))
122 122
123(ert-deftest thing-at-point-url-in-comment ()
124 (with-temp-buffer
125 (c-mode)
126 (insert "/* (http://foo/bar)\n(http://foo/bar(baz)) */\n")
127 (goto-char 6)
128 (should (equal (thing-at-point 'url) "http://foo/bar"))
129 (goto-char 23)
130 (should (equal (thing-at-point 'url) "http://foo/bar(baz)"))))
131
123;;; thingatpt.el ends here 132;;; thingatpt.el ends here