From a2217a8dba01e72354bec7738a98e76dcc22d7d6 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 10 Oct 2020 12:10:16 +0200 Subject: [PATCH] test: Add missing tests. --- spec/loophp/collection/CollectionSpec.php | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/spec/loophp/collection/CollectionSpec.php b/spec/loophp/collection/CollectionSpec.php index 9247f73f6..10566b41b 100644 --- a/spec/loophp/collection/CollectionSpec.php +++ b/spec/loophp/collection/CollectionSpec.php @@ -488,6 +488,22 @@ public function it_can_count_its_items(): void ->shouldReturn(3); } + public function it_can_current(): void + { + $input = array_combine( + range('a', 'e'), + range(1, 5) + ); + + $this::fromIterable($input) + ->current(0) + ->shouldReturn(1); + + $this::fromIterable($input) + ->current(4) + ->shouldReturn(5); + } + public function it_can_cycle(): void { $generator = static function (): Generator { @@ -1351,6 +1367,22 @@ public function it_can_intersperse(): void ->during('all'); } + public function it_can_key(): void + { + $input = array_combine( + range('a', 'e'), + range(1, 5) + ); + + $this::fromIterable($input) + ->key(0) + ->shouldReturn('a'); + + $this::fromIterable($input) + ->key(4) + ->shouldReturn('e'); + } + public function it_can_keys(): void { $this::fromIterable(range('A', 'E'))