Skip to content

Commit ac53b43

Browse files
committed
add ligature test cases to word_to_titlecase
1 parent 28d994a commit ac53b43

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • library/alloctests/tests

library/alloctests/tests/str.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,21 @@ fn word_to_titlecase() {
19221922
expected.push_str(&str::repeat("a", 510));
19231923
expected
19241924
});
1925+
1926+
// LJ ligatures and title-case characters.
1927+
// Lj is already a title-case letter, so it stays as the first char.
1928+
assert_eq!("Ljj".word_to_titlecase(), "Ljj");
1929+
assert_eq!("LjJ".word_to_titlecase(), "Ljj");
1930+
// l is the first cased char (uppercases to L), Lj lowercases to lj.
1931+
assert_eq!("lLjfi".word_to_titlecase(), "Lljfi");
1932+
assert_eq!("LLjfi".word_to_titlecase(), "Lljfi");
1933+
1934+
// LJ ligatures: lower=lj (U+01C9), upper=LJ (U+01C7), title=Lj (U+01C8).
1935+
// ß decomposes to "Ss" in title case (first char) but stays ß elsewhere.
1936+
assert_eq!("ßljLJLj".word_to_titlecase(), "Ssljljlj");
1937+
assert_eq!("ljLJLjß".word_to_titlecase(), "Ljljljß");
1938+
assert_eq!("LJLjßlj".word_to_titlecase(), "Ljljßlj");
1939+
assert_eq!("LjßljLJ".word_to_titlecase(), "Ljßljlj");
19251940
}
19261941

19271942
#[test]

0 commit comments

Comments
 (0)