Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vvval committed Mar 13, 2024
1 parent f194254 commit d00382c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/BinaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class BinaryTest extends TestCase
{
private const EMPTY_FILENAME = __DIR__ . '/assets/empty.txt';
private const STUB_FILENAME = __DIR__ . '/assets/stub.txt';
private const FILENAME = __DIR__ . '/assets/testable.txt';

Expand Down Expand Up @@ -39,6 +40,21 @@ public function testReadAllLines(): void
$this->assertSame(['hello', 'world'], $lines);
}

public function testReadLineFromEmptyFile(): void
{
$reader = Binary::reader(self::EMPTY_FILENAME);
$lines = [...$reader->readAll()];

$this->assertSame([], $lines);
}

public function testReadAllLinesFromEmptyFile(): void
{
$reader = Binary::reader(self::EMPTY_FILENAME);

$this->assertNull($reader->readLine());
}

public function testCantReadClosedFile(): void
{
$this->expectException(ReadDataException::class);
Expand Down Expand Up @@ -74,7 +90,6 @@ public function testAppendSingleLine(): void
$this->assertNull($reader->readLine());
}


public function testCantWriteToClosedFile(): void
{
$this->expectException(WriteDataException::class);
Expand Down
Empty file added tests/assets/empty.txt
Empty file.

0 comments on commit d00382c

Please sign in to comment.