0
0
mirror of https://github.com/pmmp/ext-encoding.git synced 2025-09-24 01:33:19 +00:00
Files
ext-encoding/tests/writer/trim.phpt
Dylan K. Taylor eb9610a102 Split up ByteBuffer into reader & writer parts
closes #13

This prevents accidentally writing when reading is intended, and vice
versa.
It also allows specialising the APIs and constructors.
2025-09-06 17:12:57 +01:00

23 lines
445 B
PHP

--TEST--
Test that ByteBufferWriter::trim() works correctly
--FILE--
<?php
use pmmp\encoding\ByteBufferWriter;
$buffer = new ByteBufferWriter("");
$buffer->reserve(100);
$buffer->writeByteArray("aaaaa");
var_dump($buffer->getReservedLength());
$buffer->trim();
var_dump($buffer->getReservedLength());
$buffer = new ByteBufferWriter("aaaaaaaaaa");
$buffer->trim();
var_dump($buffer->getReservedLength());
?>
--EXPECT--
int(100)
int(5)
int(10)