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 noiffion committed Aug 20, 2021
1 parent c4a6373 commit 0e74134
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 0e74134

Please sign in to comment.