diff options
| author | Chad Dougherty <crd@acm.org> | 2020-07-13 05:39:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-13 11:39:05 +0200 |
| commit | 523d18b873a319f7c09262f44bd40e2fab1830e5 (patch) | |
| tree | 32882b80a47d885117af23f2280d8b54f7793877 /exercises | |
| parent | c52be7dfcbfb99c40002f22efd32972915efebe1 (diff) | |
feat(try_from_into): Add insufficient length test (#469)
Diffstat (limited to 'exercises')
| -rw-r--r-- | exercises/conversions/try_from_into.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/exercises/conversions/try_from_into.rs b/exercises/conversions/try_from_into.rs index dbdbe00..9e452f2 100644 --- a/exercises/conversions/try_from_into.rs +++ b/exercises/conversions/try_from_into.rs @@ -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(); + } } |
