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 {
|
pub enum ModType {
|
||||||
BotModule(String),
|
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)]
|
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||||
pub enum ModGroup {
|
pub enum ModGroup {
|
||||||
Core,
|
Core,
|
||||||
|
@ -1287,10 +1298,10 @@ mod core_modulesmanager {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn WIP_case_insensitive_test() {
|
fn case_insensitive_test() {
|
||||||
Log::set_file_ext(Extension::Log);
|
Log::set_file_ext(Extension::Log);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
BotModule("test".to_string()),
|
BotModule("Test".to_string()),
|
||||||
BotModule("Test".to_lowercase())
|
BotModule("Test".to_lowercase())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue