aboutsummaryrefslogtreecommitdiff
path: root/test-org-link-edit.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-14 18:15:54 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-14 18:15:54 -0500
commit8c7318f30936b8700ba06fdd09dded174644970b (patch)
tree9027bb735a2bda8333aed3d8a4fd3345e044aa2e /test-org-link-edit.el
parent2e0805f31aac5ce33127797967bf02a8e18d8655 (diff)
downloadorg-link-edit-8c7318f30936b8700ba06fdd09dded174644970b.tar.gz
Don't use words as unit for slurping and barfing
Using words as the unit for slurping can give confusing results. For example, slurping forward with The [http://orgmode.org] Org-mode site results in The [[http://orgmode.org][Org]]-mode site This is somewhat inconvenient because the intended slurp here is most likely 'Org-mode'. However, given that the command clearly says that it works at the level of words, this shouldn't be too surprising. The problem is that, unless the user is displaying the full link (e.g., using org-toggle-link-display), the entire text 'Org-mode' is highlighted as though it's part of the link. If the user then tried to slurp again to get 'site', '-mode' would actually be slurped, and it would appear like nothing happened. Instead of words, make blocks of non-whitespace characters, referred to as blobs, the unit for slurping and barfing. When slurping forward, don't consider trailing punctuation as part of a blob.
Diffstat (limited to 'test-org-link-edit.el')
-rw-r--r--test-org-link-edit.el352
1 files changed, 248 insertions, 104 deletions
diff --git a/test-org-link-edit.el b/test-org-link-edit.el
index c6b3535..c238ec8 100644
--- a/test-org-link-edit.el
+++ b/test-org-link-edit.el
@@ -46,47 +46,63 @@ otherwise place the point at the beginning of the inserted text."
;;; Slurping
-(ert-deftest test-org-link-edit/forward-slurp-word ()
- "Test `org-link-edit-forward-slurp-word'."
- ;; Slurp one word into plain link.
+(ert-deftest test-org-link-edit/forward-slurp ()
+ "Test `org-link-edit-forward-slurp'."
+ ;; Slurp one blob into plain link.
(should
(string=
"\[\[http://orgmode.org/\]\[Org's\]\] website is"
(org-test-with-temp-text
"http://orgmode.org/ Org's website is"
- (org-link-edit-forward-slurp-word)
+ (org-link-edit-forward-slurp)
(buffer-string))))
- ;; Slurp one word into empty bracket link.
+ ;; Slurp one blob into empty bracket link.
(should
(string=
"\[\[http://orgmode.org/\]\[Org's\]\] website is"
(org-test-with-temp-text
"\[\[http://orgmode.org/\]\] Org's website is"
- (org-link-edit-forward-slurp-word)
+ (org-link-edit-forward-slurp)
(buffer-string))))
- ;; Slurp one word into bracket link.
+ ;; Slurp one blob into bracket link.
(should
(string=
"\[\[http://orgmode.org/\]\[Org's website\]\] is"
(org-test-with-temp-text
"\[\[http://orgmode.org/\]\[Org's\]\] website is"
- (org-link-edit-forward-slurp-word)
+ (org-link-edit-forward-slurp)
(buffer-string))))
- ;; Slurp two words into plain link.
+ ;; Slurp one blob, but not trailing punctuation, into bracket link.
+ (should
+ (string=
+ "\[\[http://orgmode.org/\]\[Org's website\]\]."
+ (org-test-with-temp-text
+ "\[\[http://orgmode.org/\]\[Org's\]\] website."
+ (org-link-edit-forward-slurp)
+ (buffer-string))))
+ ;; Slurp all-punctuation blob into bracket link.
+ (should
+ (string=
+ "\[\[http://orgmode.org/\]\[Org's .?.?\]\]"
+ (org-test-with-temp-text
+ "\[\[http://orgmode.org/\]\[Org's\]\] .?.?"
+ (org-link-edit-forward-slurp)
+ (buffer-string))))
+ ;; Slurp two blobs into plain link.
(should
(string=
"\[\[http://orgmode.org/\]\[Org's website\]\] is"
(org-test-with-temp-text
"http://orgmode.org/ Org's website is"
- (org-link-edit-forward-slurp-word 2)
+ (org-link-edit-forward-slurp 2)
(buffer-string))))
- ;; Slurp two words into bracket link.
+ ;; Slurp two blobs into bracket link.
(should
(string=
"\[\[http://orgmode.org/\]\[Org's website is\]\]"
(org-test-with-temp-text
"\[\[http://orgmode.org/\]\[Org's\]\] website is"
- (org-link-edit-forward-slurp-word 2)
+ (org-link-edit-forward-slurp 2)
(buffer-string))))
;; Slurp new line as space.
(should
@@ -95,73 +111,89 @@ otherwise place the point at the beginning of the inserted text."
(org-test-with-temp-text
"\[\[http://orgmode.org/\]\[Org's\]\]
website is"
- (org-link-edit-forward-slurp-word 1)
+ (org-link-edit-forward-slurp 1)
(buffer-string))))
- ;; Slurp word that has no whitespace.
+ ;; Slurp blob that has no whitespace.
(should
(string=
"\[\[http://orgmode.org/\]\[website\]\]"
(org-test-with-temp-text
"\[\[http://orgmode.org/\]\]website"
- (org-link-edit-forward-slurp-word 1)
+ (org-link-edit-forward-slurp 1)
(buffer-string))))
- ;; Slurp word beginning with non-word, non-whitespace character.
+ ;; Slurp blob that isn't separated from link by whitespace.
(should
(string=
"\[\[http://orgmode.org/\]\[-website\]\]"
(org-test-with-temp-text
"\[\[http://orgmode.org/\]\]-website"
- (org-link-edit-forward-slurp-word 1)
+ (org-link-edit-forward-slurp 1)
(buffer-string))))
- ;; Slurp beyond the number of present words.
+ ;; Slurp beyond the number of present blobs.
(should-error
(org-test-with-temp-text
"\[\[http://orgmode.org/\]\[Org's\]\] website is"
- (org-link-edit-forward-slurp-word 3)
+ (org-link-edit-forward-slurp 3)
(buffer-string))
:type (list 'user-error)))
-(ert-deftest test-org-link-edit/backward-slurp-word ()
- "Test `org-link-edit-backward-slurp-word'."
- ;; Slurp one word into plain link.
+(ert-deftest test-org-link-edit/backward-slurp ()
+ "Test `org-link-edit-backward-slurp'."
+ ;; Slurp one blob into plain link.
(should
(string=
"Here \[\[http://orgmode.org/\]\[is\]\] Org's website"
(org-test-with-temp-text
"Here is <point>http://orgmode.org/ Org's website"
- (org-link-edit-backward-slurp-word)
+ (org-link-edit-backward-slurp)
(buffer-string))))
- ;; Slurp one word into empty bracket link.
+ ;; Slurp one blob into empty bracket link.
(should
(string=
"Here \[\[http://orgmode.org/\]\[is\]\] Org's website"
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\] Org's website"
- (org-link-edit-backward-slurp-word)
+ (org-link-edit-backward-slurp)
(buffer-string))))
- ;; Slurp one word into bracket link.
+ ;; Slurp one blob into bracket link.
(should
(string=
"Here \[\[http://orgmode.org/\]\[is Org's\]\] website"
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-backward-slurp-word)
+ (org-link-edit-backward-slurp)
+ (buffer-string))))
+ ;; Slurp one blob with trailing punctuation into bracket link.
+ (should
+ (string=
+ "Here \[\[http://orgmode.org/\]\[is: Org's\]\] website."
+ (org-test-with-temp-text
+ "Here is: <point>\[\[http://orgmode.org/\]\[Org's\]\] website."
+ (org-link-edit-backward-slurp)
+ (buffer-string))))
+ ;; Slurp all-punctuation blob into bracket link.
+ (should
+ (string=
+ "Here \[\[http://orgmode.org/\]\[... Org's\]\] website."
+ (org-test-with-temp-text
+ "Here ... <point>\[\[http://orgmode.org/\]\[Org's\]\] website."
+ (org-link-edit-backward-slurp)
(buffer-string))))
- ;; Slurp two words into plain link.
+ ;; Slurp two blobs into plain link.
(should
(string=
"\[\[http://orgmode.org/\]\[Here is\]\] Org's website"
(org-test-with-temp-text
"Here is <point>http://orgmode.org/ Org's website"
- (org-link-edit-backward-slurp-word 2)
+ (org-link-edit-backward-slurp 2)
(buffer-string))))
- ;; Slurp two words into bracket link.
+ ;; Slurp two blobs into bracket link.
(should
(string=
"\[\[http://orgmode.org/\]\[Here is Org's\]\] website"
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-backward-slurp-word 2)
+ (org-link-edit-backward-slurp 2)
(buffer-string))))
;; Slurp new line as space.
(should
@@ -170,149 +202,189 @@ website is"
(org-test-with-temp-text
"Here is
<point>\[\[http://orgmode.org/\]\[Org's website\]\]"
- (org-link-edit-backward-slurp-word 1)
+ (org-link-edit-backward-slurp 1)
(buffer-string))))
- ;; Slurp word that has no whitespace.
+ ;; Slurp blob that has no whitespace.
(should
(string=
"Here \[\[http://orgmode.org/\]\[is\]\] Org's website"
(org-test-with-temp-text
"Here is<point>\[\[http://orgmode.org/\]\] Org's website"
- (org-link-edit-backward-slurp-word 1)
+ (org-link-edit-backward-slurp 1)
(buffer-string))))
- ;; Slurp word ending with non-word, non-whitespace character.
+ ;; Slurp blob that isn't separated from link by whitespace.
(should
(string=
"Here \[\[http://orgmode.org/\]\[is-\]\] Org's website"
(org-test-with-temp-text
"Here is-<point>\[\[http://orgmode.org/\]\] Org's website"
- (org-link-edit-backward-slurp-word 1)
+ (org-link-edit-backward-slurp 1)
(buffer-string))))
- ;; Slurp beyond the number of present words.
+ ;; Slurp beyond the number of present blobs.
(should-error
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-backward-slurp-word 3)
+ (org-link-edit-backward-slurp 3)
(buffer-string))
:type (list 'user-error)))
(ert-deftest test-org-link-edit/slurp-negative-argument ()
- "Test `org-link-edit-forward-slurp-word' and
-`org-link-edit-backward-slurp-word' with negative arguments."
+ "Test `org-link-edit-forward-slurp' and
+`org-link-edit-backward-slurp' with negative arguments."
(should
(string=
(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-slurp 1)
(buffer-string))
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-backward-slurp-word -1)
+ (org-link-edit-backward-slurp -1)
(buffer-string))))
(should
(string=
(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-slurp -1)
(buffer-string))
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-backward-slurp-word)
+ (org-link-edit-backward-slurp)
(buffer-string)))))
;;; Barfing
-(ert-deftest test-org-link-edit/forward-barf-word ()
- "Test `org-link-edit-forward-barf-word'."
- ;; Barf last word.
+(ert-deftest test-org-link-edit/forward-barf ()
+ "Test `org-link-edit-forward-barf'."
+ ;; Barf last blob.
(should
(string=
"Org's \[\[http://orgmode.org/\]\] website is"
(org-test-with-temp-text
"Org's <point>\[\[http://orgmode.org/\]\[website\]\] is"
- (org-link-edit-forward-barf-word)
+ (org-link-edit-forward-barf)
+ (buffer-string))))
+ ;; Barf last blob with puctuation.
+ (should
+ (string=
+ "Org's \[\[http://orgmode.org/\]\] website,"
+ (org-test-with-temp-text
+ "Org's <point>\[\[http://orgmode.org/\]\[website,\]\]"
+ (org-link-edit-forward-barf)
+ (buffer-string))))
+ ;; Barf last blob, all punctuation.
+ (should
+ (string=
+ "Org's \[\[http://orgmode.org/\]\] ..."
+ (org-test-with-temp-text
+ "Org's <point>\[\[http://orgmode.org/\]\[...\]\]"
+ (org-link-edit-forward-barf)
(buffer-string))))
- ;; Barf two last words.
+ ;; Barf two last blobs.
(should
(string=
"Org's \[\[http://orgmode.org/\]\] website is"
(org-test-with-temp-text
"Org's <point>\[\[http://orgmode.org/\]\[website is\]\]"
- (org-link-edit-forward-barf-word 2)
+ (org-link-edit-forward-barf 2)
(buffer-string))))
- ;; Barf one word, not last.
+ ;; Barf one blob, not last.
(should
(string=
"Org's \[\[http://orgmode.org/\]\[website\]\] is"
(org-test-with-temp-text
"Org's <point>\[\[http://orgmode.org/\]\[website is\]\]"
- (org-link-edit-forward-barf-word 1)
+ (org-link-edit-forward-barf 1)
(buffer-string))))
- ;; Barf beyond the number of present words.
+ ;; Barf beyond the number of present blobs.
(should-error
(org-test-with-temp-text
"Org's <point>\[\[http://orgmode.org/\]\[website is\]\]"
- (org-link-edit-forward-barf-word 3)
+ (org-link-edit-forward-barf 3)
(buffer-string))
:type (list 'user-error)))
-(ert-deftest test-org-link-edit/backward-barf-word ()
- "Test `org-link-edit-backward-barf-word'."
- ;; Barf last word.
+(ert-deftest test-org-link-edit/backward-barf ()
+ "Test `org-link-edit-backward-barf'."
+ ;; Barf last blob.
(should
(string=
"Org's website \[\[http://orgmode.org/\]\] is"
(org-test-with-temp-text
"Org's <point>\[\[http://orgmode.org/\]\[website\]\] is"
- (org-link-edit-backward-barf-word)
+ (org-link-edit-backward-barf)
+ (buffer-string))))
+ ;; Barf last blob with puctuation.
+ (should
+ (string=
+ "Org's website: \[\[http://orgmode.org/\]\]"
+ (org-test-with-temp-text
+ "Org's <point>\[\[http://orgmode.org/\]\[website:\]\]"
+ (org-link-edit-backward-barf)
(buffer-string))))
- ;; Barf two last words.
+ ;; Barf last all-puctuation blob.
+ (should
+ (string=
+ "Org's ... \[\[http://orgmode.org/\]\]"
+ (org-test-with-temp-text
+ "Org's <point>\[\[http://orgmode.org/\]\[...\]\]"
+ (org-link-edit-backward-barf)
+ (buffer-string))))
+ ;; Barf two last blobs.
(should
(string=
"Org's website is \[\[http://orgmode.org/\]\]"
(org-test-with-temp-text
"Org's <point>\[\[http://orgmode.org/\]\[website is\]\]"
- (org-link-edit-backward-barf-word 2)
+ (org-link-edit-backward-barf 2)
(buffer-string))))
- ;; Barf one word, not last.
+ ;; Barf one blob, not last.
(should
(string=
"Org's website \[\[http://orgmode.org/\]\[is\]\]"
(org-test-with-temp-text
"Org's <point>\[\[http://orgmode.org/\]\[website is\]\]"
- (org-link-edit-backward-barf-word 1)
+ (org-link-edit-backward-barf 1)
+ (buffer-string))))
+ ;; Barf one blob with punctuation, not last.
+ (should
+ (string=
+ "Org's website. \[\[http://orgmode.org/\]\[is\]\]"
+ (org-test-with-temp-text
+ "Org's <point>\[\[http://orgmode.org/\]\[website. is\]\]"
+ (org-link-edit-backward-barf 1)
(buffer-string))))
- ;; Barf beyond the number of present words.
+ ;; Barf beyond the number of present blobs.
(should-error
(org-test-with-temp-text
"Org's <point>\[\[http://orgmode.org/\]\[website is\]\]"
- (org-link-edit-backward-barf-word 3)
+ (org-link-edit-backward-barf 3)
(buffer-string))
:type (list 'user-error)))
(ert-deftest test-org-link-edit/barf-negative-argument ()
- "Test `org-link-edit-forward-barf-word' and
-`org-link-edit-backward-barf-word' with negative arguments."
+ "Test `org-link-edit-forward-barf' and
+`org-link-edit-backward-barf' with negative arguments."
(should
(string=
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-forward-barf-word 1)
+ (org-link-edit-forward-barf 1)
(buffer-string))
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-backward-barf-word -1)
+ (org-link-edit-backward-barf -1)
(buffer-string))))
(should
(string=
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-forward-barf-word -1)
+ (org-link-edit-forward-barf -1)
(buffer-string))
(org-test-with-temp-text
"Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website"
- (org-link-edit-backward-barf-word)
+ (org-link-edit-backward-barf)
(buffer-string)))))
@@ -327,35 +399,35 @@ website is"
;; space.
(ert-deftest test-org-link-edit/slurp-barf-round-trip ()
- "Test `org-link-edit-forward-barf-word' and
-`org-link-edit-backward-barf-word' reversibility."
+ "Test `org-link-edit-forward-barf' and
+`org-link-edit-backward-barf' reversibility."
(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-barf-word 1)
- (org-link-edit-forward-slurp-word 1)
+ (org-link-edit-forward-barf 1)
+ (org-link-edit-forward-slurp 1)
(buffer-string))))
(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)
+ (org-link-edit-forward-slurp 1)
+ (org-link-edit-forward-barf 1)
(buffer-string))))
(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-backward-barf-word 1)
- (org-link-edit-backward-slurp-word 1)
+ (org-link-edit-backward-barf 1)
+ (org-link-edit-backward-slurp 1)
(buffer-string))))
(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-backward-slurp-word 1)
- (org-link-edit-backward-barf-word 1)
+ (org-link-edit-backward-slurp 1)
+ (org-link-edit-backward-barf 1)
(buffer-string))))
;; Failed round trip because of newline.
(should
@@ -363,8 +435,8 @@ website is"
(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)
+ (org-link-edit-forward-slurp 1)
+ (org-link-edit-forward-barf 1)
(buffer-string))))
;; Failed round trip because of empty description and more than one
;; whitespace.
@@ -372,8 +444,8 @@ website"
(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)
+ (org-link-edit-forward-slurp 1)
+ (org-link-edit-forward-barf 1)
(buffer-string)))))
@@ -394,35 +466,107 @@ website"
(should (string= link "http://orgmode.org/"))
(should (string= desc "org"))))
-(ert-deftest test-org-link-edit/split-first-words ()
- "Test `org-link-edit--split-first-words'."
- ;; Single word, n = 1
+(ert-deftest test-org-link-edit/forward-blob ()
+ "Test `org-link-edit--forward-blob'."
+ ;; Move forward one blob.
+ (should
+ (string=
+ "one"
+ (org-test-with-temp-text "one two"
+ (org-link-edit--forward-blob 1)
+ (buffer-substring (point-min) (point)))))
+ ;; Move forward one blob with point mid.
+ (should
+ (string=
+ "one"
+ (org-test-with-temp-text "o<point>ne two"
+ (org-link-edit--forward-blob 1)
+ (buffer-substring (point-min) (point)))))
+ ;; Move forward two blobs.
+ (should
+ (string=
+ "one two"
+ (org-test-with-temp-text "one two"
+ (org-link-edit--forward-blob 2)
+ (buffer-substring (point-min) (point)))))
+ ;; Move forward blob, including punctuation.
+ (should
+ (string=
+ "one."
+ (org-test-with-temp-text "one."
+ (org-link-edit--forward-blob 1)
+ (buffer-substring (point-min) (point)))))
+ ;; Move forward blob, adjusting for punctuation.
+ (should
+ (string=
+ "one"
+ (org-test-with-temp-text "one."
+ (org-link-edit--forward-blob 1 t)
+ (buffer-substring (point-min) (point)))))
+ ;; Move forward blob consisting of only punctuation characters.
+ (should
+ (string=
+ "...."
+ (org-test-with-temp-text "...."
+ (org-link-edit--forward-blob 1 t)
+ (buffer-substring (point-min) (point)))))
+ ;; Move backward one blob.
+ (should
+ (string=
+ "two"
+ (org-test-with-temp-text "one two<point>"
+ (org-link-edit--forward-blob -1)
+ (buffer-substring (point) (point-max)))))
+ ;; Move backward two blobs.
+ (should
+ (string=
+ "one two"
+ (org-test-with-temp-text "one two<point>"
+ (org-link-edit--forward-blob -2)
+ (buffer-substring (point) (point-max)))))
+ ;; Move backward one blobs, including punctuation.
+ (should
+ (string=
+ ".two."
+ (org-test-with-temp-text "one .two.<point>"
+ (org-link-edit--forward-blob -1)
+ (buffer-substring (point) (point-max)))))
+ ;; Move beyond last blob.
+ (org-test-with-temp-text "one two"
+ (should (org-link-edit--forward-blob 1))
+ (should-not (org-link-edit--forward-blob 2))
+ (should (string= "one two"
+ (buffer-substring (point-min) (point))))))
+
+(ert-deftest test-org-link-edit/split-firsts ()
+ "Test `org-link-edit--split-first-blobs'."
+ ;; Single blob, n = 1
(should (equal '("one" . "")
- (org-link-edit--split-first-words "one" 1)))
- ;; Single word, out-of-bounds
+ (org-link-edit--split-first-blobs "one" 1)))
+ ;; Single blob, out-of-bounds
(should (equal '("one" . nil)
- (org-link-edit--split-first-words "one" 2)))
- ;; Multiple words, n = 1
+ (org-link-edit--split-first-blobs "one" 2)))
+ ;; Multiple blobs, n = 1
(should (equal '("one " . "two three")
- (org-link-edit--split-first-words "one two three" 1)))
- ;; Multiple words, n > 1
+ (org-link-edit--split-first-blobs "one two three" 1)))
+ ;; Multiple blobs, n > 1
(should (equal '("one two " . "three")
- (org-link-edit--split-first-words "one two three" 2))))
+ (org-link-edit--split-first-blobs "one two three" 2))))
-(ert-deftest test-org-link-edit/split-last-words ()
- "Test `org-link-edit--split-last-words'."
- ;; Single word, n = 1
+(ert-deftest test-org-link-edit/split-lasts ()
+ "Test `org-link-edit--split-last-blobs'."
+ ;; Single blob, n = 1
(should (equal '("" . "one")
- (org-link-edit--split-last-words "one" 1)))
- ;; Single word, out-of-bounds
+ (org-link-edit--split-last-blobs "one" 1)))
+ ;; Single blob, out-of-bounds
(should (equal '(nil . "one")
- (org-link-edit--split-last-words "one" 2)))
- ;; Multiple words, n = 1
+ (org-link-edit--split-last-blobs "one" 2)))
+ ;; Multiple blobs, n = 1
(should (equal '("one two" . " three")
- (org-link-edit--split-last-words "one two three" 1)))
- ;; Multiple words, n > 1
+ (org-link-edit--split-last-blobs "one two three" 1)))
+ ;; Multiple blobs, n > 1
(should (equal '("one" . " two three")
- (org-link-edit--split-last-words "one two three" 2))))
+ (org-link-edit--split-last-blobs "one two three" 2))))
(provide 'test-org-link-edit)
;;; test-org-link-edit.el ends here