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 DeepSpace2 committed Jul 23, 2020
1 parent 4cf1288 commit 8ce031e
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 8ce031e

Please sign in to comment.