From e743191f45932eb2c4eb3069caf46a80c76277a6 Mon Sep 17 00:00:00 2001 From: Smoren Date: Sun, 10 Mar 2024 11:14:02 +0300 Subject: [PATCH] tests upd --- README.md | 1 + tests/unit/Examples/ExamplesTest.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 2d3dbe4..ab71b0c 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ $originalView = ArrayView::toView($originalArray); $originalView.subview(new MaskSelector([true, false, true, false, true])).toArray(); // [1, 3, 5] $originalView.subview(new IndexListSelector([1, 2, 4])).toArray(); // [2, 3, 5] $originalView.subview(new SliceSelector('::-1')).toArray(); // [5, 4, 3, 2, 1] +$originalView.subview('::-1').toArray(); // [5, 4, 3, 2, 1] $originalView.subview(new MaskSelector([true, false, true, false, true])).apply(fn ($x) => x * 10); print_r(originalArray); // [10, 2, 30, 4, 50] diff --git a/tests/unit/Examples/ExamplesTest.php b/tests/unit/Examples/ExamplesTest.php index 37db3a6..0ae6cbe 100644 --- a/tests/unit/Examples/ExamplesTest.php +++ b/tests/unit/Examples/ExamplesTest.php @@ -44,6 +44,10 @@ public function testSubview() [5, 4, 3, 2, 1], $originalView->subview(new SliceSelector('::-1'))->toArray(), ); + $this->assertSame( + [5, 4, 3, 2, 1], + $originalView->subview('::-1')->toArray(), + ); $originalView->subview(new MaskSelector([true, false, true, false, true])) ->apply(fn(int $x) => $x * 10);