Skip to content

Commit

Permalink
feat(try_from_into): Add insufficient length test (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Dougherty authored Jul 13, 2020
1 parent c52be7d commit 523d18b
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 523d18b

Please sign in to comment.