diff --git a/test/Unit/JsonPointerTest.php b/test/Unit/JsonPointerTest.php index 3ec12fa9..dcc15143 100644 --- a/test/Unit/JsonPointerTest.php +++ b/test/Unit/JsonPointerTest.php @@ -50,8 +50,7 @@ public function provideInvalidJsonStringValue(): \Generator { $values = [ 'does-not-start-with-forward-slash' => 'foo', - 'property-with-unescaped-tilde' => '/foo~bar', - 'property-with-unescaped-tildes' => '/foo~~bar', + 'property-with-tilde-followed-by-word' => '/foo~bar', ]; foreach ($values as $key => $value) { @@ -59,6 +58,22 @@ public function provideInvalidJsonStringValue(): \Generator $value, ]; } + + foreach (\range(2, 9) as $digit) { + $key = \sprintf( + 'property-with-tilde-followed-by-digit-%d', + $digit, + ); + + $value = \sprintf( + '/foo~%d', + $digit, + ); + + yield $key => [ + $value, + ]; + } } /** diff --git a/test/Unit/ReferenceTokenTest.php b/test/Unit/ReferenceTokenTest.php index 56b784b4..23cd2d88 100644 --- a/test/Unit/ReferenceTokenTest.php +++ b/test/Unit/ReferenceTokenTest.php @@ -47,8 +47,8 @@ public function testFromJsonStringRejectsInvalidValue(string $value): void public function provideInvalidJsonStringValue(): \Generator { $values = [ - 'property-with-unescaped-forward-slash' => 'foo/bar', - 'property-with-unescaped-tilde' => 'foo~bar', + 'property-with-slash-forward' => 'foo/bar', + 'property-with-tilde-followed-by-word' => 'foo~bar', ]; foreach ($values as $key => $value) { @@ -56,6 +56,22 @@ public function provideInvalidJsonStringValue(): \Generator $value, ]; } + + foreach (\range(2, 9) as $digit) { + $key = \sprintf( + 'property-with-tilde-followed-by-digit-%d', + $digit, + ); + + $value = \sprintf( + 'foo~%d', + $digit, + ); + + yield $key => [ + $value, + ]; + } } /** @@ -124,7 +140,7 @@ public function provideValueAndJsonStringValue(): \Generator "'", "'", ], - 'slash-backwards' => [ + 'slash-backward' => [ '\\', '\\', ], @@ -168,11 +184,11 @@ public function provideValueAndJsonStringValue(): \Generator "foo'bar", "foo'bar", ], - 'with-slash-backwards' => [ + 'with-slash-backward' => [ 'foo\\bar', 'foo\\bar', ], - 'with-slash-forwards' => [ + 'with-slash-forward' => [ 'foo/bar', 'foo~1bar', ],