mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-25 23:04:17 -05:00
adds additional test to meet exercise rules
This commit is contained in:
parent
8b9479071c
commit
bc22ec382f
1 changed files with 7 additions and 0 deletions
|
@ -70,4 +70,11 @@ mod tests {
|
|||
assert_eq!(p.name, "Mark");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue