Add a Recurring status to TaskChampion
This commit is contained in:
committed by
Tomas Babej
parent
6e5d8b1dde
commit
9add31104b
@@ -5,6 +5,7 @@ pub enum Status {
|
||||
Pending,
|
||||
Completed,
|
||||
Deleted,
|
||||
Recurring,
|
||||
/// Unknown signifies a status in the task DB that was not
|
||||
/// recognized. This supports forward-compatibility if a
|
||||
/// new status is added. Tasks with unknown status should
|
||||
@@ -20,6 +21,7 @@ impl Status {
|
||||
"pending" => Status::Pending,
|
||||
"completed" => Status::Completed,
|
||||
"deleted" => Status::Deleted,
|
||||
"recurring" => Status::Recurring,
|
||||
v => Status::Unknown(v.to_string()),
|
||||
}
|
||||
}
|
||||
@@ -30,6 +32,7 @@ impl Status {
|
||||
Status::Pending => "pending",
|
||||
Status::Completed => "completed",
|
||||
Status::Deleted => "deleted",
|
||||
Status::Recurring => "recurring",
|
||||
Status::Unknown(v) => v.as_ref(),
|
||||
}
|
||||
}
|
||||
@@ -45,6 +48,7 @@ mod test {
|
||||
assert_eq!(Status::Pending.to_taskmap(), "pending");
|
||||
assert_eq!(Status::Completed.to_taskmap(), "completed");
|
||||
assert_eq!(Status::Deleted.to_taskmap(), "deleted");
|
||||
assert_eq!(Status::Recurring.to_taskmap(), "recurring");
|
||||
assert_eq!(Status::Unknown("wishful".into()).to_taskmap(), "wishful");
|
||||
}
|
||||
|
||||
@@ -53,6 +57,7 @@ mod test {
|
||||
assert_eq!(Status::from_taskmap("pending"), Status::Pending);
|
||||
assert_eq!(Status::from_taskmap("completed"), Status::Completed);
|
||||
assert_eq!(Status::from_taskmap("deleted"), Status::Deleted);
|
||||
assert_eq!(Status::from_taskmap("recurring"), Status::Recurring);
|
||||
assert_eq!(
|
||||
Status::from_taskmap("something-else"),
|
||||
Status::Unknown("something-else".into())
|
||||
@@ -64,6 +69,7 @@ mod test {
|
||||
assert_eq!(format!("{}", Status::Pending), "Pending");
|
||||
assert_eq!(format!("{}", Status::Completed), "Completed");
|
||||
assert_eq!(format!("{}", Status::Deleted), "Deleted");
|
||||
assert_eq!(format!("{}", Status::Recurring), "Recurring");
|
||||
assert_eq!(format!("{}", Status::Unknown("wishful".into())), "Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user