mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Fix conversion from TCStatus::Unknown
(#3561)
Before this patch, the messsage would be "unknown TCStatus 4294967295" (i.e. `u32::MAX`) instead of "unknown TCStatus -1".
This commit is contained in:
parent
7ea4baed77
commit
40ea3f2f54
1 changed files with 14 additions and 1 deletions
|
@ -42,7 +42,7 @@ impl From<TCStatus> for Status {
|
|||
TCStatus::Completed => Status::Completed,
|
||||
TCStatus::Deleted => Status::Deleted,
|
||||
TCStatus::Recurring => Status::Recurring,
|
||||
_ => Status::Unknown(format!("unknown TCStatus {}", status as u32)),
|
||||
_ => Status::Unknown(format!("unknown TCStatus {}", status as i32)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,3 +58,16 @@ impl From<Status> for TCStatus {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn conversion_from_unknown_tc_status_provides_discriminant_in_message() {
|
||||
let tc_status = TCStatus::Unknown;
|
||||
let status = Status::from(tc_status);
|
||||
|
||||
assert!(matches!(status, Status::Unknown(msg) if msg == "unknown TCStatus -1"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue