oooo tests pass
parent
a627223e8a
commit
4f4e7fd907
|
|
@ -77,12 +77,13 @@ impl When {
|
|||
_ => {},
|
||||
};
|
||||
match TS::new(self.0.clone()) {
|
||||
Ok(ts) => { return ts; },
|
||||
Ok(ts) => {
|
||||
return ts;
|
||||
},
|
||||
_ => {},
|
||||
};
|
||||
match Cron::new(self.0.clone()) {
|
||||
Ok(x) => {
|
||||
eprintln!("cron::new({:?}) => {:?}", self.0.clone(), x.clone());
|
||||
return x.next(now);
|
||||
},
|
||||
_ => {},
|
||||
|
|
@ -180,7 +181,10 @@ struct Duration(u64);
|
|||
|
||||
impl Duration {
|
||||
fn new(src: String) -> Result<Duration, String> {
|
||||
let duration = Regex::new(r"([0-9]+d)?([0-9]+h)?([0-9]+m)?").unwrap();
|
||||
if src.len() == 0 {
|
||||
return Err("no empty duration".to_string());
|
||||
}
|
||||
let duration = Regex::new(r"^([0-9]+d)?([0-9]+h)?([0-9]+m)?$").unwrap();
|
||||
match duration.is_match(&src) {
|
||||
false => { return Err("ill formatted duration".to_string()); },
|
||||
_ => {},
|
||||
|
|
|
|||
Loading…
Reference in New Issue