From 523d18b873a319f7c09262f44bd40e2fab1830e5 Mon Sep 17 00:00:00 2001 From: Chad Dougherty Date: Mon, 13 Jul 2020 05:39:05 -0400 Subject: [PATCH] feat(try_from_into): Add insufficient length test (#469) --- exercises/conversions/try_from_into.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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(); + } }