summaryrefslogtreecommitdiff
path: root/test/lisp/thingatpt-tests.el
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2017-06-15 11:49:56 +0200
committerPhilipp Stephani <phst@google.com>2017-06-16 18:06:28 +0200
commit3b6e01cccf89ba0f3485751125f43463bc429345 (patch)
tree439adae70db311405f2abd6369ad75004eb2eca4 /test/lisp/thingatpt-tests.el
parentea196ebb93188b0962f478f5dec0ff0645c4da10 (diff)
downloademacs-3b6e01cccf89ba0f3485751125f43463bc429345.tar.gz
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/lisp/thingatpt-tests.el')
-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.")
(should (equal (list-at-point)
(cdr str-res)))))))
+(ert-deftest thing-at-point-url-in-comment ()
+ (with-temp-buffer
+ (c-mode)
+ (insert "/* (http://foo/bar)\n(http://foo/bar(baz)) */\n")
+ (goto-char 6)
+ (should (equal (thing-at-point 'url) "http://foo/bar"))
+ (goto-char 23)
+ (should (equal (thing-at-point 'url) "http://foo/bar(baz)"))))
+
;;; thingatpt.el ends here