Skip to content

Commit

Permalink
#7 - preserve ability to match certain non-ASCII characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Jan 16, 2023
1 parent d3ff8c6 commit 4e0866b
Show file tree
Hide file tree
Showing 3 changed files with 1,357 additions and 1,352 deletions.
3 changes: 3 additions & 0 deletions src/censor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1258,15 +1258,18 @@ mod tests {
use crate::add_word;

let test_profanity = "thisisafakeprofanityfortesting";
let test_profanity_issue_7 = "плохоеслово";
let test_safe = "thisisafakesafewordfortesting";

// SAFETY: Tests are run serially, so concurrent mutation is avoided.
unsafe {
add_word(test_profanity, Type::PROFANE & Type::SEVERE);
add_word(test_profanity_issue_7, Type::PROFANE & Type::SEVERE);
add_word(test_safe, Type::SAFE);
}

assert!(test_profanity.is(Type::PROFANE & Type::SEVERE));
assert!(test_profanity_issue_7.is(Type::PROFANE & Type::SEVERE));
assert!(test_safe.is(Type::SAFE));

unsafe {
Expand Down
4 changes: 3 additions & 1 deletion src/replacement_finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ fn main() {
find_char.zip(replace_char).and_then(|(find, replace)| {
if replace.is_digit(36) {
println!("{find} -> {replace}");
Some((find, replace.to_string()))
let mut replace = replace.to_string();
replace.push(find);
Some((find, replace))
} else if find.is_digit(36) {
panic!("reversed!");
//println!("{replace} -> {find} (REV)");
Expand Down
Loading

0 comments on commit 4e0866b

Please sign in to comment.