botmodule case insensitive
This commit is contained in:
parent
0d6cc132ea
commit
072903882d
1 changed files with 14 additions and 3 deletions
|
@ -272,11 +272,22 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
|||
|
||||
|
||||
|
||||
#[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())
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue