Skip to content

Commit

Permalink
Auto merge of #284 - sl4m:update-from-into-ex, r=fmoko
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
bors committed Mar 11, 2020
2 parents 8b94790 + bc22ec3 commit 700b236
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions exercises/conversions/from_into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 700b236

Please sign in to comment.