mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 05:52:23 -05:00
feat(from_into) : add test for checking unnecessary trailing value
This commit is contained in:
parent
5a0521e92c
commit
4f1374a6e7
1 changed files with 14 additions and 0 deletions
|
@ -115,4 +115,18 @@ mod tests {
|
|||
assert_eq!(p.name, "John");
|
||||
assert_eq!(p.age, 30);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_trailing_comma() {
|
||||
let p: Person = Person::from("Mike,32,");
|
||||
assert_eq!(p.name, "John");
|
||||
assert_eq!(p.age, 30);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_trailing_comma_and_some_string() {
|
||||
let p: Person = Person::from("Mike,32,man");
|
||||
assert_eq!(p.name, "John");
|
||||
assert_eq!(p.age, 30);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue