1
0
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:
Niklas Keller 2018-09-21 22:27:35 +02:00
parent 75aa20de7c
commit a4cf31f089
2 changed files with 20 additions and 1 deletions

View File

@ -43,7 +43,6 @@ function pipe(InputStream $source, OutputStream $destination): Promise {
/** /**
* @param \Amp\ByteStream\InputStream $source * @param \Amp\ByteStream\InputStream $source
* @param \Amp\ByteStream\OutputStream $destination
* *
* @return \Amp\Promise * @return \Amp\Promise
*/ */

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