mirror of
https://github.com/danog/amp.git
synced 2024-11-30 04:29:08 +01:00
c12828081f
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.
22 lines
487 B
PHP
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)));
|
|
}
|
|
}
|