mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-26 07:14:17 -05:00
feat(try_from_into): Add insufficient length test (#469)
This commit is contained in:
parent
c52be7dfcb
commit
523d18b873
1 changed files with 6 additions and 0 deletions
|
@ -127,4 +127,10 @@ mod tests {
|
||||||
let v = vec![0, 0, 0, 0];
|
let v = vec![0, 0, 0, 0];
|
||||||
let _ = Color::try_from(&v[..]).unwrap();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue