This repository has been archived on 2023-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
2018-02-22 00:09:53 -06:00
|
|
|
// primitive_types4.rs
|
2019-11-12 05:50:33 -06:00
|
|
|
// Get a slice out of Array a where the ??? is so that the test passes.
|
2022-07-12 07:54:12 -05:00
|
|
|
// Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand for a hint.
|
2016-02-07 11:24:38 -06:00
|
|
|
|
2019-08-17 19:14:00 -05:00
|
|
|
#[test]
|
2019-11-12 05:50:33 -06:00
|
|
|
fn slice_out_of_array() {
|
2016-02-07 11:24:38 -06:00
|
|
|
let a = [1, 2, 3, 4, 5];
|
|
|
|
|
2023-03-24 16:18:51 -05:00
|
|
|
let nice_slice = &a[1..4];
|
2020-04-08 03:42:35 -05:00
|
|
|
|
|
|
|
assert_eq!([2, 3, 4], nice_slice)
|
2016-02-07 11:24:38 -06:00
|
|
|
}
|