1
0
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:
Niklas Keller 2018-10-05 21:06:27 +02:00
parent 22a8332261
commit a60a8e1906

22
test/CollectTest.php Normal file
View 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)));
}
}