Skip to content

Commit

Permalink
test(configs): added create_control_char_replace_map test #1068
Browse files Browse the repository at this point in the history
  • Loading branch information
hitenkoku committed Jun 9, 2023
1 parent ce031b3 commit 96f8cb8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/detections/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,10 @@ fn create_control_chat_replace_map() -> HashMap<char, CompactString> {
mod tests {
use crate::detections::configs;
use chrono::{DateTime, Utc};
use hashbrown::HashSet;
use compact_str::CompactString;
use hashbrown::{HashMap, HashSet};

use super::create_control_chat_replace_map;

// #[test]
// #[ignore]
Expand Down Expand Up @@ -1843,4 +1846,19 @@ mod tests {
assert!(ret.contains(&contents.to_string()));
}
}

#[test]
fn test_create_control_char_replace_map() {
let expect: HashMap<char, CompactString> = HashMap::from_iter(('\0'..='\x1F').map(|c| {
(
c as u8 as char,
CompactString::from(format!(
"\\u00{}",
format!("{:02x}", c as u8).to_uppercase()
)),
)
}));
let actual = create_control_chat_replace_map();
assert_eq!(expect, actual);
}
}

0 comments on commit 96f8cb8

Please sign in to comment.