Skip to content

Commit 700b236

Browse files
committed
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).
2 parents 8b94790 + bc22ec3 commit 700b236

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

exercises/conversions/from_into.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,11 @@ mod tests {
7070
assert_eq!(p.name, "Mark");
7171
assert_eq!(p.age, 20);
7272
}
73+
#[test]
74+
fn test_bad_age() {
75+
// Test that "Mark.twenty" will return the default person due to an error in parsing age
76+
let p = Person::from("Mark,twenty");
77+
assert_eq!(p.name, "John");
78+
assert_eq!(p.age, 30);
79+
}
7380
}

0 commit comments

Comments
 (0)