aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-23 03:38:25 -0500
committerCraig Jennings <c@cjennings.net>2026-05-23 03:38:25 -0500
commit3841c59ec034ecfd60d4ea78929a1e8c95abb9bb (patch)
tree5f82b9432ef719cce28033b94fa535f9b2cf2f86
parent08930121d17d5ee9bab737e52d846fa84786f3ff (diff)
downloaddotemacs-3841c59ec034ecfd60d4ea78929a1e8c95abb9bb.tar.gz
dotemacs-3841c59ec034ecfd60d4ea78929a1e8c95abb9bb.zip
test(custom-case): cover leading-quote, paren, and RTL title-case edges
The state machine in cj/title-case-region skips leading non-word characters and passes caseless letters through, but no test pinned that. I added three boundary cases: a leading double-quote and a leading paren each still capitalize the first real word, and a caseless RTL first word (Hebrew) passes through while consuming the is-first slot, so the following minor word stays lowercase.
-rw-r--r--tests/test-custom-case-title-case-region.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test-custom-case-title-case-region.el b/tests/test-custom-case-title-case-region.el
index b2d5d1e0..383ae927 100644
--- a/tests/test-custom-case-title-case-region.el
+++ b/tests/test-custom-case-title-case-region.el
@@ -185,6 +185,22 @@ Note: 'is' is explicitly in the minor word list, so it stays lowercase."
"the lord of the rings: the return of the king")
"The Lord of the Rings: The Return of the King")))
+(ert-deftest test-custom-case-title-case-region-boundary-leading-quote ()
+ "A leading quote is skipped; the first real word is still capitalized."
+ (should (equal (test-title-case--on-string "\"the quick brown fox\"")
+ "\"The Quick Brown Fox\"")))
+
+(ert-deftest test-custom-case-title-case-region-boundary-leading-paren ()
+ "A leading paren is skipped; the first real word is still capitalized."
+ (should (equal (test-title-case--on-string "(the lazy dog)")
+ "(The Lazy Dog)")))
+
+(ert-deftest test-custom-case-title-case-region-boundary-rtl-first-word ()
+ "A caseless RTL first word passes through and consumes the is-first slot,
+so the following minor word stays lowercase."
+ (should (equal (test-title-case--on-string "שלום the world")
+ "שלום the World")))
+
;;; Error Cases
(ert-deftest test-custom-case-title-case-region-error-numeric-only ()