Skip to content

Commit

Permalink
make sure Content::ofLines() and ::ofChunks() hold the properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptouuuu committed Oct 21, 2023
1 parent 23c7196 commit b85fe02
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion proofs/file/content.php
@@ -1,12 +1,19 @@
<?php
declare(strict_types = 1);

use Innmind\Filesystem\File\Content as Model;
use Innmind\Filesystem\File\{
Content as Model,
Content\Line,
};
use Properties\Innmind\Filesystem\Content;
use Innmind\BlackBox\Set;
use Innmind\IO\IO;
use Innmind\Stream\Streams;
use Innmind\Url\Path;
use Innmind\Immutable\{
Str,
Sequence,
};

return static function() {
$capabilities = Streams::fromAmbientAuthority();
Expand All @@ -31,6 +38,24 @@
'Content::none()',
Set\Elements::of(Model::none()),
],
[
'Content::ofLines()',
Set\Sequence::of(
Set\Strings::madeOf(
Set\Unicode::any()->filter(static fn($char) => $char !== "\n"),
)
->map(Str::of(...))
->map(Line::of(...)),
)
->map(static fn($lines) => Model::ofLines(Sequence::of(...$lines))),
],
[
'Content::ofChunks()',
Set\Sequence::of(
Set\Strings::madeOf(Set\Unicode::any())->map(Str::of(...)),
)
->map(static fn($chunks) => Model::ofChunks(Sequence::of(...$chunks))),
],
];

foreach ($implementations as [$name, $content]) {
Expand Down

0 comments on commit b85fe02

Please sign in to comment.