mirror of
https://github.com/danog/byte-stream.git
synced 2024-11-26 20:04:51 +01:00
Add buffer test
This commit is contained in:
parent
75aa20de7c
commit
a4cf31f089
@ -43,7 +43,6 @@ function pipe(InputStream $source, OutputStream $destination): Promise {
|
||||
|
||||
/**
|
||||
* @param \Amp\ByteStream\InputStream $source
|
||||
* @param \Amp\ByteStream\OutputStream $destination
|
||||
*
|
||||
* @return \Amp\Promise
|
||||
*/
|
||||
|
20
test/BufferTest.php
Normal file
20
test/BufferTest.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Amp\ByteStream\Test;
|
||||
|
||||
use function Amp\ByteStream\buffer;
|
||||
use Amp\ByteStream\IteratorStream;
|
||||
use Amp\Iterator;
|
||||
use Amp\PHPUnit\TestCase;
|
||||
use function Amp\Promise\wait;
|
||||
|
||||
class BufferTest extends TestCase
|
||||
{
|
||||
public function testBuffer()
|
||||
{
|
||||
$stream = new IteratorStream(Iterator\fromIterable(["abc", "def", "g"], 10));
|
||||
|
||||
$this->assertSame("abcdefg", wait(buffer($stream)));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user