@@ -4,33 +4,33 @@ use crate::affix::RuleType::{self, Prefix, Suffix};
4
4
#[ test]
5
5
fn test_check_condition ( ) {
6
6
let mut kind = RuleType :: Suffix ;
7
- let mut rule = AfxRulePattern :: default ( ) ;
8
- rule . set_pattern ( "[^aeiou]y" , kind) . unwrap ( ) ;
7
+ let mut rule_pat = AfxRulePattern :: default ( ) ;
8
+ rule_pat . set_pattern ( "[^aeiou]y" , kind) . unwrap ( ) ;
9
9
10
10
// General tests, including with pattern in the middle
11
- assert ! ( rule . check_condition( "xxxy" ) ) ;
12
- assert ! ( !rule . check_condition( "xxxay" ) ) ;
13
- assert ! ( !rule . check_condition( "xxxyxx" ) ) ;
11
+ assert ! ( rule_pat . check_condition( "xxxy" ) ) ;
12
+ assert ! ( !rule_pat . check_condition( "xxxay" ) ) ;
13
+ assert ! ( !rule_pat . check_condition( "xxxyxx" ) ) ;
14
14
15
15
// Test with prefix
16
16
kind = RuleType :: Prefix ;
17
- rule . set_pattern ( "y[^aeiou]" , kind) . unwrap ( ) ;
18
- assert ! ( rule . check_condition( "yxxx" ) ) ;
19
- assert ! ( !rule . check_condition( "yaxxx" ) ) ;
20
- assert ! ( !rule . check_condition( "xxxyxxx" ) ) ;
17
+ rule_pat . set_pattern ( "y[^aeiou]" , kind) . unwrap ( ) ;
18
+ assert ! ( rule_pat . check_condition( "yxxx" ) ) ;
19
+ assert ! ( !rule_pat . check_condition( "yaxxx" ) ) ;
20
+ assert ! ( !rule_pat . check_condition( "xxxyxxx" ) ) ;
21
21
22
22
// Test other real rules
23
23
kind = RuleType :: Suffix ;
24
- rule . set_pattern ( "[sxzh]" , kind) . unwrap ( ) ;
25
- assert ! ( rule . check_condition( "access" ) ) ;
26
- assert ! ( rule . check_condition( "abyss" ) ) ;
27
- assert ! ( !rule . check_condition( "accomplishment" ) ) ;
28
- assert ! ( rule . check_condition( "mmms" ) ) ;
29
- assert ! ( !rule . check_condition( "mmsmm" ) ) ;
24
+ rule_pat . set_pattern ( "[sxzh]" , kind) . unwrap ( ) ;
25
+ assert ! ( rule_pat . check_condition( "access" ) ) ;
26
+ assert ! ( rule_pat . check_condition( "abyss" ) ) ;
27
+ assert ! ( !rule_pat . check_condition( "accomplishment" ) ) ;
28
+ assert ! ( rule_pat . check_condition( "mmms" ) ) ;
29
+ assert ! ( !rule_pat . check_condition( "mmsmm" ) ) ;
30
30
31
31
// Check with default condition
32
- rule . set_pattern ( "." , kind) . unwrap ( ) ;
33
- assert ! ( rule . check_condition( "xxx" ) ) ;
32
+ rule_pat . set_pattern ( "." , kind) . unwrap ( ) ;
33
+ assert ! ( rule_pat . check_condition( "xxx" ) ) ;
34
34
}
35
35
36
36
// affix, strip, condition, kind, input, output
0 commit comments