1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-12-12 11:14:55 +02:00

feat(try_from_into): Add insufficient length test (#469)

This commit is contained in:
Chad Dougherty 2020-07-13 05:39:05 -04:00 committed by GitHub
parent c52be7dfcb
commit 523d18b873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,4 +127,10 @@ mod tests {
let v = vec![0, 0, 0, 0];
let _ = Color::try_from(&v[..]).unwrap();
}
#[test]
#[should_panic]
fn test_slice_insufficient_length() {
let v = vec![0, 0];
let _ = Color::try_from(&v[..]).unwrap();
}
}