Skip to content

Commit

Permalink
feat(try_from_into): Add insufficient length test (rust-lang#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Dougherty authored and Nuno Pereira committed Sep 29, 2020
1 parent 7799956 commit ab9ffaa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions exercises/conversions/try_from_into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit ab9ffaa

Please sign in to comment.