mirror of
https://github.com/pcvolkmer/checkbar.git
synced 2025-04-19 19:16:50 +00:00
Use empty CheckConfig vec as default
This commit is contained in:
parent
5cc33c983e
commit
102e707b4d
@ -11,6 +11,7 @@ pub struct Config {
|
||||
#[serde(default, deserialize_with = "deserialize_duration")]
|
||||
pub interval: Option<Duration>,
|
||||
pub colors: Option<ColorConfig>,
|
||||
#[serde(default)]
|
||||
pub checks: Vec<CheckConfig>,
|
||||
}
|
||||
|
||||
@ -182,6 +183,18 @@ mod tests {
|
||||
assert_eq!(config.interval, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_parse_config_without_checks() {
|
||||
let config: Config = toml::from_str(
|
||||
r#"
|
||||
interval = "2m 3s"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(config.checks.len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_should_parse_durations() {
|
||||
assert_eq!(parse_duration("1m30s"), Some(Duration::from_secs(90)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user