adds additional test to meet exercise rules

This commit is contained in:
skim 2020-03-10 15:21:37 -07:00 committed by skim
parent 8b9479071c
commit bc22ec382f
No known key found for this signature in database
GPG Key ID: C34FAB15A47E38FA

View File

@ -70,4 +70,11 @@ mod tests {
assert_eq!(p.name, "Mark"); assert_eq!(p.name, "Mark");
assert_eq!(p.age, 20); assert_eq!(p.age, 20);
} }
#[test]
fn test_bad_age() {
// Test that "Mark.twenty" will return the default person due to an error in parsing age
let p = Person::from("Mark,twenty");
assert_eq!(p.name, "John");
assert_eq!(p.age, 30);
}
} }