Hyphenation: exact German pattern count, a parser test for skipped commands

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NaxvogandClaude Opus 5.5 committed 2026-10-18 09:48:38 +02:00
1 parent 7968a4452b
commit 9f34c5ad61
2 files changed
+8 -1

No files matched your search

+1 -1
View File
@@ -861,7 +861,7 @@ mod tests {
#[test]
fn german_patterns_load() {
let p = Patterns::de();
assert!(p.len() >= 36_709, "{}", p.len());
assert_eq!(p.len(), 36_709);
// The file has no exception words, and its `\message{…}` line adds none.
assert_eq!(p.exception_count(), 0);
}
+7
View File
@@ -142,6 +142,7 @@ impl Patterns {
block = match name {
"hyphenation" => Block::Exceptions,
"patterns" => Block::Patterns,
// shortcut: the argument ends at the first `}`, so nested braces would leak; no bundled file has them.
_ if cmd.contains('{') => Block::Skip,
_ => Block::Patterns,
};
@@ -345,6 +346,12 @@ mod tests {
assert!(p.to_tex().contains(&".ab4cdefghijklm5n".to_string()));
}
#[test]
fn other_commands_arguments_are_skipped() {
let p = Patterns::parse("\\message{Some Patterns `x-y' 2024-02-28}\n\\patterns{%\na1b\n}\n\\endinput\n");
assert_eq!((p.len(), p.exception_count()), (1, 0));
}
#[test]
fn apply_tolerates_short_value_buffers() {
let p = Patterns::parse("a1b");