Skip to content

Commit

Permalink
Add a test case for twofold suffix stripping
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Aug 21, 2023
1 parent 211a147 commit 37c012f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ impl Display for ParseDictionaryErrorKind {

#[cfg(test)]
mod test {
use super::*;
use crate::{aff::FlagType, FlagSet};

fn simple_flag_set(flags: &str) -> FlagSet {
Expand Down Expand Up @@ -177,4 +178,24 @@ mod test {
assert!(!simple_flag_set("abc").is_superset(&simple_flag_set("abcd")));
assert!(!simple_flag_set("ac").is_superset(&simple_flag_set("abc")));
}

#[test]
fn test_twofold_suffix_stripping() {
// This case is straight from the hunspell man page.
let aff = r#"
SFX Y Y 1
SFX Y 0 s .
SFX X Y 1
SFX X 0 able/Y .
"#;
let dic = r#"1
drink/X"#;
let dict = Dictionary::compile(aff, dic).unwrap();

assert!(dict.check("drink"));
assert!(dict.check("drinkable"));
// Uses the 's' and 'able' suffix.
assert!(dict.check("drinkables"));
}
}

0 comments on commit 37c012f

Please sign in to comment.