mirror of
https://github.com/danog/amp.git
synced 2024-11-26 20:15:00 +01:00
Add tests for Iterator\collect
This commit is contained in:
parent
22a8332261
commit
a60a8e1906
22
test/CollectTest.php
Normal file
22
test/CollectTest.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Amp\Test;
|
||||
|
||||
use Amp\Iterator;
|
||||
use Amp\PHPUnit\TestCase;
|
||||
use function Amp\Promise\wait;
|
||||
|
||||
class CollectTest extends TestCase
|
||||
{
|
||||
public function testCollect()
|
||||
{
|
||||
$iterator = Iterator\fromIterable(["abc", "foo", "bar"], 5);
|
||||
$this->assertSame(["abc", "foo", "bar"], wait(Iterator\collect($iterator)));
|
||||
}
|
||||
|
||||
public function testEmpty()
|
||||
{
|
||||
$iterator = Iterator\fromIterable([], 5);
|
||||
$this->assertSame([], wait(Iterator\collect($iterator)));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user