aboutsummaryrefslogtreecommitdiff
path: root/test-org-link-edit.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-14 02:17:36 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-14 02:17:36 -0500
commit4f40284b0d37d4b58fe725ff259417bde1578148 (patch)
tree0bb20504566a2f9e76f99a35ffca81c2a4116b92 /test-org-link-edit.el
parentaf3a3a69f63d138477201e742fb34f0e2f445900 (diff)
downloadorg-link-edit-4f40284b0d37d4b58fe725ff259417bde1578148.tar.gz
Add tests for round trip exceptions
Diffstat (limited to 'test-org-link-edit.el')
-rw-r--r--test-org-link-edit.el27
1 files changed, 25 insertions, 2 deletions
diff --git a/test-org-link-edit.el b/test-org-link-edit.el
index 53c4d87..f7048b7 100644
--- a/test-org-link-edit.el
+++ b/test-org-link-edit.el
@@ -318,8 +318,13 @@ website is"
;;; Slurp and Barf round trip
;;
-;; Slurping and barfing should round trip unless there are new lines
-;; in the slurped string, which slurping replaces with spaces.
+;; Slurping and then barfing in the same direction, and vice versa,
+;; usually result in the original link stage. This is not true in the
+;; following cases.
+;; - The slurped string contains one or more newlines.
+;; - When slurping into a link with an empty description, the slurped
+;; string is separated from a link by whitespace other than a single
+;; space.
(ert-deftest test-org-link-edit/slurp-barf-round-trip ()
"Test `org-link-edit-forward-barf-word' and
@@ -350,6 +355,24 @@ website is"
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
(org-link-edit-backward-slurp-word 1)
(org-link-edit-backward-barf-word 1)
+ (buffer-string))))
+ ;; Failed round trip because of newline.
+ (should
+ (string= "Here is \[\[http://orgmode.org/\]\[Org's\]\] website"
+ (org-test-with-temp-text
+ "Here is <point>\[\[http://orgmode.org/\]\[Org's\]\]
+website"
+ (org-link-edit-forward-slurp-word 1)
+ (org-link-edit-forward-barf-word 1)
+ (buffer-string))))
+ ;; Failed round trip because of empty description and more than one
+ ;; whitespace.
+ (should
+ (string= "Here is \[\[http://orgmode.org/\]\] website"
+ (org-test-with-temp-text
+ "Here is <point>\[\[http://orgmode.org/\]\] website"
+ (org-link-edit-forward-slurp-word 1)
+ (org-link-edit-forward-barf-word 1)
(buffer-string)))))