pub fn convert_to_kebab_case(input: &str) -> String {
inflections::case::to_kebab_case(input)
}
pub fn convert_to_camel_case(input: &str) -> String {
inflections::case::to_camel_case(input)
}
#[cfg(test)]
mod tests {
use crate::{convert_to_camel_case, convert_to_kebab_case};
#[test]
fn check_camel_case_to_kebab_case() {
let result = convert_to_kebab_case("myPlugin");
assert_eq!(result, "my-plugin".to_owned());
}
#[test]
fn check_pascal_case_to_kebab_case() {
let result = convert_to_kebab_case("MyPlugin");
assert_eq!(result, "my-plugin".to_owned());
}
#[test]
fn check_constant_case_to_kebab_case() {
let result = convert_to_kebab_case("myplugin");
assert_eq!(result, "myplugin".to_owned());
}
#[test]
fn check_kebab_case_to_camel_case() {
let result = convert_to_camel_case("my-plugin");
assert_eq!(result, "myPlugin".to_owned());
}
#[test]
fn check_pascal_case_to_camel_case() {
let result = convert_to_camel_case("MyPlugin");
assert_eq!(result, "myPlugin".to_owned());
}
#[test]
fn check_constant_case_to_camel_case() {
let result = convert_to_camel_case("plugin");
assert_eq!(result, "plugin".to_owned());
}
}