From 4bf0ee1a22bbed2cd0fd93080cc570cc4744a4fe Mon Sep 17 00:00:00 2001 From: Adam Kern Date: Mon, 14 Oct 2024 18:24:38 -0400 Subject: [PATCH] Tests that the *Assign operators work for slices via deref --- tests/array.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/array.rs b/tests/array.rs index 696904dab..9b4e4cc90 100644 --- a/tests/array.rs +++ b/tests/array.rs @@ -2819,3 +2819,11 @@ fn test_split_complex_invert_axis() assert_eq!(cmplx.re, a.mapv(|z| z.re)); assert_eq!(cmplx.im, a.mapv(|z| z.im)); } + +#[test] +fn test_slice_assing() +{ + let mut a = array![0, 1, 2, 3, 4]; + *a.slice_mut(s![1..3]) += 1; + assert_eq!(a, array![0, 2, 3, 3, 4]); +}