Fix the caps kicker to trigger on ratio, not uppercase count
All checks were successful
CI / check (push) Successful in 5m16s
All checks were successful
CI / check (push) Successful in 5m16s
This commit is contained in:
parent
e4a2e76903
commit
d0a86359c2
2 changed files with 15 additions and 1 deletions
|
|
@ -941,3 +941,15 @@
|
|||
assert_eq!(db.channel("#foo").unwrap().join_mode("alice"), None, "purge holds after replay");
|
||||
assert_eq!(db.channel_successor("#bar"), None, "successor purge holds after replay");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn caps_kicker_triggers_on_ratio_not_uppercase_count() {
|
||||
let k = KickerSettings { caps: true, ..Default::default() };
|
||||
// 9 uppercase in an 18-char line is ~50% caps and over the length floor —
|
||||
// it must trip even though the uppercase count is below caps_min (a prior
|
||||
// `upper >= min` bug let it slip through).
|
||||
assert_eq!(k.violation("AAAAAAAAA hi there"), Some("Turn caps lock off!"));
|
||||
// A short or low-ratio line still doesn't trip.
|
||||
assert_eq!(k.violation("Hello there"), None);
|
||||
assert_eq!(k.violation("YO"), None, "too short for the length floor");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue