From 5204f6837d1b8b795ab6c905c9bc301f3b2f5964 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]); +}