Add negative test case (invalid input -> Err result)
This commit is contained in:
@@ -23,6 +23,12 @@ mod tests {
|
|||||||
|
|
||||||
let status = Status::try_from("Done".to_string()).unwrap();
|
let status = Status::try_from("Done".to_string()).unwrap();
|
||||||
assert_eq!(status, Status::Done);
|
assert_eq!(status, Status::Done);
|
||||||
|
|
||||||
|
let empty = String::new();
|
||||||
|
assert!(Status::try_from(empty).is_err());
|
||||||
|
|
||||||
|
let invalid = "InValid".to_string();
|
||||||
|
assert!(Status::try_from(invalid).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -35,5 +41,8 @@ mod tests {
|
|||||||
|
|
||||||
let status = Status::try_from("done").unwrap();
|
let status = Status::try_from("done").unwrap();
|
||||||
assert_eq!(status, Status::Done);
|
assert_eq!(status, Status::Done);
|
||||||
|
|
||||||
|
assert!(Status::try_from("").is_err());
|
||||||
|
assert!(Status::try_from("invalid").is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user