Skip to content

Commit

Permalink
Update src/append/rolling_file/policy/compound/trigger/time.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Bryan Conn <[email protected]>
  • Loading branch information
Dirreke and bconn98 authored Dec 23, 2023
1 parent 8ba121e commit d542b8b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/append/rolling_file/policy/compound/trigger/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,36 +442,64 @@ mod test {
let limit = format!("limit: 1 second",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Second(1));

let limit = format!("limit: 1 seconds",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Second(1));

// str minute
let limit = format!("limit: 1 minute",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Minute(1));

let limit = format!("limit: 1 minutes",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Minute(1));

// str hour
let limit = format!("limit: 1 hour",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Hour(1));

let limit = format!("limit: 1 hours",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Hour(1));

// str day
let limit = format!("limit: 1 day",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Day(1));

let limit = format!("limit: 1 days",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Day(1));

// str week
let limit = format!("limit: 1 week",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Week(1));

let limit = format!("limit: 1 weeks",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Week(1));

// str month
let limit = format!("limit: 1 month",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Month(1));

let limit = format!("limit: 1 months",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Month(1));

// str year
let limit = format!("limit: 1 year",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Year(1));

let limit = format!("limit: 1 years",);
let limit = ::serde_yaml::from_str::<TimeTriggerConfig>(&limit).unwrap();
assert_eq!(limit.limit, TimeTriggerLimit::Year(1));
}

#[test]
Expand Down

0 comments on commit d542b8b

Please sign in to comment.