mirror of
https://github.com/helix-editor/spellbook.git
synced 2025-10-06 00:02:48 +02:00
checker: Add unit test for REP end pattern panic
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user