diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index 568683a..cc4b1aa 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -272,11 +272,22 @@ pub async fn init(mgr: Arc) { -#[derive(Debug, PartialEq, Eq, Hash, Clone)] +// #[derive(Debug, PartialEq, Eq, Hash, Clone)] +#[derive(Debug, Hash, Clone)] pub enum ModType { BotModule(String), } +impl PartialEq for ModType { + fn eq(&self, other: &Self) -> bool { + let BotModule(name1) = self.clone(); + let BotModule(name2) = other.clone(); + name1.to_lowercase() == name2.to_lowercase() + } +} +impl Eq for ModType {} + + #[derive(Debug, PartialEq, Eq, Hash, Clone)] pub enum ModGroup { Core, @@ -1287,10 +1298,10 @@ mod core_modulesmanager { use super::*; #[test] - fn WIP_case_insensitive_test() { + fn case_insensitive_test() { Log::set_file_ext(Extension::Log); assert_eq!( - BotModule("test".to_string()), + BotModule("Test".to_string()), BotModule("Test".to_lowercase()) ); }