From 4f40284b0d37d4b58fe725ff259417bde1578148 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 14 Feb 2015 02:17:36 -0500 Subject: Add tests for round trip exceptions --- test-org-link-edit.el | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'test-org-link-edit.el') 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 \[\[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 \[\[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 \[\[http://orgmode.org/\]\] website" + (org-link-edit-forward-slurp-word 1) + (org-link-edit-forward-barf-word 1) (buffer-string))))) -- cgit v1.2.3