diff options
author | Kyle Meyer <kyle@kyleam.com> | 2017-03-03 00:10:00 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2017-03-03 00:29:36 -0500 |
commit | ae8e918c873febd58abfc332ebf8f59448e8fff4 (patch) | |
tree | d526f32083d7bc1aa1cf1681353ab2bbcd5c567d /test-org-link-edit.el | |
parent | 5dd5901cf6850f2bfdba64c896d10b017633600e (diff) | |
download | org-link-edit-ae8e918c873febd58abfc332ebf8f59448e8fff4.tar.gz |
Add a separate function for testing if point is on a link
The slurping and barfing commands are interested in point being on a
link, so it is sufficient for them to use org-link-edit--get-link-data
and get a user-error when point is not on a link. But an upcoming
command will want to know that point is _not_ in a link.
Diffstat (limited to 'test-org-link-edit.el')
-rw-r--r-- | test-org-link-edit.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test-org-link-edit.el b/test-org-link-edit.el index 893cec5..4f006e7 100644 --- a/test-org-link-edit.el +++ b/test-org-link-edit.el @@ -513,6 +513,28 @@ website" ;;; Other +(ert-deftest test-org-link-edit/on-link-p () + "Test `org-link-edit--on-link-p'." + ;; On plain link + (should + (org-test-with-temp-text "http://orgmode.org/" + (org-link-edit--on-link-p))) + ;; On bracket link + (should + (org-test-with-temp-text "\[\[http://orgmode.org/\]\[org\]\]" + (org-link-edit--on-link-p))) + ;; Point beyond link, but technically still within link element. + (should + (org-test-with-temp-text "\[\[http://orgmode.org/\]\[org\]\] <point>" + (org-link-edit--on-link-p))) + ;; Not on a link + (should-not + (org-test-with-temp-text " \[\[http://orgmode.org/\]\[org\]\]" + (org-link-edit--on-link-p))) + (should-not + (org-test-with-temp-text "not a link" + (org-link-edit--on-link-p)))) + (ert-deftest test-org-link-edit/get-link-data () "Test `org-link-edit--link-data'." ;; Plain link |