chore: lint
This commit is contained in:
parent
61562a0943
commit
fdc77b74ae
1 changed files with 35 additions and 51 deletions
|
@ -61,122 +61,106 @@ mod unit_test {
|
||||||
let katakana_2 = r#"/[ア-ン]/u"#.to_string();
|
let katakana_2 = r#"/[ア-ン]/u"#.to_string();
|
||||||
let emoji = r#"/[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/u"#.to_string();
|
let emoji = r#"/[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/u"#.to_string();
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(&texts, &[], &["/the/i".to_string()]));
|
||||||
&texts,
|
|
||||||
&vec![],
|
|
||||||
&vec!["/the/i".to_string()]
|
|
||||||
));
|
|
||||||
|
|
||||||
assert!(!check_word_mute_impl(
|
assert!(!check_word_mute_impl(&texts, &[], &["/the/".to_string()]));
|
||||||
&texts,
|
|
||||||
&vec![],
|
assert!(check_word_mute_impl(&texts, &[], &["/QuICk/i".to_string()]));
|
||||||
&vec!["/the/".to_string()]
|
|
||||||
));
|
assert!(!check_word_mute_impl(&texts, &[], &["/QuICk/".to_string()]));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec![],
|
&[
|
||||||
&vec!["/QuICk/i".to_string()]
|
|
||||||
));
|
|
||||||
|
|
||||||
assert!(!check_word_mute_impl(
|
|
||||||
&texts,
|
|
||||||
&vec![],
|
|
||||||
&vec!["/QuICk/".to_string()]
|
|
||||||
));
|
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
|
||||||
&texts,
|
|
||||||
&vec![
|
|
||||||
"我".to_string(),
|
"我".to_string(),
|
||||||
"有為の奥山 今日越えて 浅き夢見し 酔ひもせず".to_string()
|
"有為の奥山 今日越えて 浅き夢見し 酔ひもせず".to_string()
|
||||||
],
|
],
|
||||||
&vec![]
|
&[]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(!check_word_mute_impl(
|
assert!(!check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["有為の奥山 今日越えて 浅き夢見し 酔ひもせず".to_string()],
|
&["有為の奥山 今日越えて 浅き夢見し 酔ひもせず".to_string()],
|
||||||
&vec![]
|
&[]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(!check_word_mute_impl(
|
assert!(!check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec![
|
&[
|
||||||
"有為の奥山".to_string(),
|
"有為の奥山".to_string(),
|
||||||
"今日越えて".to_string(),
|
"今日越えて".to_string(),
|
||||||
"浅き夢見し".to_string(),
|
"浅き夢見し".to_string(),
|
||||||
"酔ひもせず".to_string()
|
"酔ひもせず".to_string()
|
||||||
],
|
],
|
||||||
&vec![]
|
&[]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["yellow fox".to_string(), "mastodon".to_string()],
|
&["yellow fox".to_string(), "mastodon".to_string()],
|
||||||
&vec![hiragana_1.clone()]
|
&[hiragana_1.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["yellow fox".to_string(), "mastodon".to_string()],
|
&["yellow fox".to_string(), "mastodon".to_string()],
|
||||||
&vec![hiragana_2.clone()]
|
&[hiragana_2.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(!check_word_mute_impl(
|
assert!(!check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["yellow fox".to_string(), "mastodon".to_string()],
|
&["yellow fox".to_string(), "mastodon".to_string()],
|
||||||
&vec![katakana_1.clone()]
|
&[katakana_1.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(!check_word_mute_impl(
|
assert!(!check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["yellow fox".to_string(), "mastodon".to_string()],
|
&["yellow fox".to_string(), "mastodon".to_string()],
|
||||||
&vec![katakana_2.clone()]
|
&[katakana_2.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["brown fox".to_string(), "mastodon".to_string()],
|
&["brown fox".to_string(), "mastodon".to_string()],
|
||||||
&vec![katakana_1.clone()]
|
&[katakana_1.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["brown fox".to_string(), "mastodon".to_string()],
|
&["brown fox".to_string(), "mastodon".to_string()],
|
||||||
&vec![katakana_2.clone()]
|
&[katakana_2.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["yellow fox".to_string(), "dog".to_string()],
|
&["yellow fox".to_string(), "dog".to_string()],
|
||||||
&vec![katakana_1.clone()]
|
&[katakana_1.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["yellow fox".to_string(), "dog".to_string()],
|
&["yellow fox".to_string(), "dog".to_string()],
|
||||||
&vec![katakana_2.clone()]
|
&[katakana_2.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["yellow fox".to_string(), "mastodon".to_string()],
|
&["yellow fox".to_string(), "mastodon".to_string()],
|
||||||
&vec![hiragana_1.clone(), katakana_1.clone()]
|
&[hiragana_1.clone(), katakana_1.clone()]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(
|
assert!(check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["😇".to_string(), "🥲".to_string(), "🥴".to_string()],
|
&["😇".to_string(), "🥲".to_string(), "🥴".to_string()],
|
||||||
&vec![]
|
&[]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(!check_word_mute_impl(
|
assert!(!check_word_mute_impl(
|
||||||
&texts,
|
&texts,
|
||||||
&vec!["🙂".to_string(), "🥲".to_string(), "🥴".to_string()],
|
&["🙂".to_string(), "🥲".to_string(), "🥴".to_string()],
|
||||||
&vec![]
|
&[]
|
||||||
));
|
));
|
||||||
|
|
||||||
assert!(check_word_mute_impl(&texts, &vec![], &vec![emoji.clone()]));
|
assert!(check_word_mute_impl(&texts, &[], &[emoji.clone()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue