checker: Add unit test for REP end pattern panic

This commit is contained in:
Michael Davis
2025-04-30 10:08:31 -04:00
parent d917733ef9
commit 6739b13aae

View File

@@ -2738,4 +2738,39 @@ mod test {
assert!(dict.check("macroconcierto"));
}
#[test]
fn rep_panic() {
// <https://github.com/blopker/codebook/issues/72>
let aff = r#"
# At least this many letters in each word within a compound:
COMPOUNDMIN 1
# Don't allow autogenerated compounds that are very similar
# to some word in the dictionary:
CHECKCOMPOUNDREP
# For suffixes used to create first part of a compound
COMPOUNDPERMITFLAG W
# May appear first in compound words:
COMPOUNDBEGIN X
# May be middle elements in compound words:
COMPOUNDMIDDLE U
# May appear last in compound words:
COMPOUNDEND Y
REP 1
REP ochmed$ _och_med
SFX f N 2
SFX f a s/WUZ a
SFX f 0 s/WUZ [^a]
"#;
let dic = r#"3
träd/ABDXY
algoritm/ADHTXY
sökning/ADfGvY
"#;
let dict = Dictionary::new(aff, dic).unwrap();
assert!(dict.check("trädsökningsalgoritm"));
}
}