mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 14:02:22 -05:00
feat(from_str) : add test for checking unnecessary trailing value
This commit is contained in:
parent
9c4614f7e6
commit
5a0521e92c
1 changed files with 12 additions and 0 deletions
|
@ -82,4 +82,16 @@ mod tests {
|
||||||
fn missing_name_and_invalid_age() {
|
fn missing_name_and_invalid_age() {
|
||||||
",one".parse::<Person>().unwrap();
|
",one".parse::<Person>().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[should_panic]
|
||||||
|
fn trailing_comma() {
|
||||||
|
"John,32,".parse::<Person>().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[should_panic]
|
||||||
|
fn trailing_comma_and_some_string() {
|
||||||
|
"John,32,man".parse::<Person>().unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue