mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 22:02:22 -05:00
Auto merge of #284 - sl4m:update-from-into-ex, r=fmoko
Adds additional test to meet exercise rules This PR adds an additional test to meet this exercise [rule](https://github.com/rust-lang/rustlings/blob/master/exercises/conversions/from_into.rs#L33).
This commit is contained in:
commit
700b236f4d
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