1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00
amp/test/IteratorToArrayTest.php
Niklas Keller c12828081f Fix exceptions bubbling from Coroutine::__destruct
This has been an edge case potentially hiding some exceptions. The tests have been refactored to error if the loop has watchers leaking from one test to another test.
2019-05-31 11:38:02 -05:00

22 lines
487 B
PHP

<?php
namespace Amp\Test;
use Amp\Iterator;
use function Amp\Promise\wait;
class IteratorToArrayTest extends BaseTest
{
public function testNonEmpty()
{
$iterator = Iterator\fromIterable(["abc", "foo", "bar"], 5);
$this->assertSame(["abc", "foo", "bar"], wait(Iterator\toArray($iterator)));
}
public function testEmpty()
{
$iterator = Iterator\fromIterable([], 5);
$this->assertSame([], wait(Iterator\toArray($iterator)));
}
}