2020-01-16 08:37:12 +01:00
|
|
|
use crate::common::*;
|
|
|
|
|
2020-03-28 02:41:35 +01:00
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, EnumVariantNames, EnumString, IntoStaticStr)]
|
|
|
|
#[strum(serialize_all = "kebab-case")]
|
2020-01-16 08:37:12 +01:00
|
|
|
pub(crate) enum UseColor {
|
|
|
|
Auto,
|
|
|
|
Always,
|
|
|
|
Never,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::*;
|
|
|
|
|
2020-03-28 02:41:35 +01:00
|
|
|
#[test]
|
|
|
|
fn variants() {
|
|
|
|
assert_eq!(UseColor::VARIANTS, &["auto", "always", "never"]);
|
|
|
|
}
|
|
|
|
|
2020-01-16 08:37:12 +01:00
|
|
|
#[test]
|
|
|
|
fn from_str() {
|
2020-03-28 02:41:35 +01:00
|
|
|
assert_eq!(UseColor::Auto, "auto".parse().unwrap());
|
|
|
|
assert_eq!(UseColor::Always, "always".parse().unwrap());
|
|
|
|
assert_eq!(UseColor::Never, "never".parse().unwrap());
|
2020-01-16 08:37:12 +01:00
|
|
|
}
|
|
|
|
}
|