Skip to content

Commit 6739b13

Browse files
committed
checker: Add unit test for REP end pattern panic
1 parent d917733 commit 6739b13

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

src/checker.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,4 +2738,39 @@ mod test {
27382738

27392739
assert!(dict.check("macroconcierto"));
27402740
}
2741+
2742+
#[test]
2743+
fn rep_panic() {
2744+
// <https://github.com/blopker/codebook/issues/72>
2745+
let aff = r#"
2746+
# At least this many letters in each word within a compound:
2747+
COMPOUNDMIN 1
2748+
# Don't allow autogenerated compounds that are very similar
2749+
# to some word in the dictionary:
2750+
CHECKCOMPOUNDREP
2751+
# For suffixes used to create first part of a compound
2752+
COMPOUNDPERMITFLAG W
2753+
# May appear first in compound words:
2754+
COMPOUNDBEGIN X
2755+
# May be middle elements in compound words:
2756+
COMPOUNDMIDDLE U
2757+
# May appear last in compound words:
2758+
COMPOUNDEND Y
2759+
2760+
REP 1
2761+
REP ochmed$ _och_med
2762+
2763+
SFX f N 2
2764+
SFX f a s/WUZ a
2765+
SFX f 0 s/WUZ [^a]
2766+
2767+
"#;
2768+
let dic = r#"3
2769+
träd/ABDXY
2770+
algoritm/ADHTXY
2771+
sökning/ADfGvY
2772+
"#;
2773+
let dict = Dictionary::new(aff, dic).unwrap();
2774+
assert!(dict.check("trädsökningsalgoritm"));
2775+
}
27412776
}

0 commit comments

Comments
 (0)