test for deserialization from string

This commit is contained in:
Filip Bachul 2022-04-05 16:42:17 +02:00
parent 82b5b6ea1b
commit c1a0cefc30

View File

@ -133,6 +133,24 @@ mod tests {
assert!(style.should_apply(&context));
}
#[test]
fn should_deserialize_from_string_value() {
let config = toml::value::Value::String(String::from("bold red dimmed"));
let deserializer = ValueDeserializer::new(&config);
let result = StarshipConditionalStyle::deserialize(deserializer);
assert_eq!(
result,
Ok(StarshipConditionalStyle {
env: None,
operator: None,
expected_value: None,
style: "bold dimmed red"
})
);
}
#[test]
fn should_deserialize_from_table_value() {
let config = toml::toml! {