diff --git a/fixtures/Path.php b/fixtures/Path.php index de15e0d..8f9afa1 100644 --- a/fixtures/Path.php +++ b/fixtures/Path.php @@ -31,8 +31,9 @@ public static function directories(): Set */ private static function strings(): Set { - return Set::strings()->filter( - static fn($value) => (bool) \preg_match('~\S+~', $value), - ); + return Set::strings() + ->filter(static fn($value) => (bool) \preg_match('~\S+~', $value)) + ->exclude(static fn($value) => \str_contains($value, '//')) + ->exclude(static fn($value) => \str_starts_with($value, '\\')); } } diff --git a/tests/PathTest.php b/tests/PathTest.php index 01551a2..7dfd97e 100644 --- a/tests/PathTest.php +++ b/tests/PathTest.php @@ -110,6 +110,13 @@ public function testResolveAbsolutility(): BlackBox\Proof }); } + public function testPathStartingWithBackslashIsInvalid() + { + $this->assert()->throws( + static fn() => Path::of('\\\\'), + ); + } + public static function resolutions(): array { return [