Skip to content

Commit d545054

Browse files
authored
Merge pull request #15 from ergebnis/fix/cases
Fix: Cases
2 parents 537a5b0 + c3f7f02 commit d545054

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

test/Unit/JsonPointerTest.php

+17-2
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,30 @@ public function provideInvalidJsonStringValue(): \Generator
5050
{
5151
$values = [
5252
'does-not-start-with-forward-slash' => 'foo',
53-
'property-with-unescaped-tilde' => '/foo~bar',
54-
'property-with-unescaped-tildes' => '/foo~~bar',
53+
'property-with-tilde-followed-by-word' => '/foo~bar',
5554
];
5655

5756
foreach ($values as $key => $value) {
5857
yield $key => [
5958
$value,
6059
];
6160
}
61+
62+
foreach (\range(2, 9) as $digit) {
63+
$key = \sprintf(
64+
'property-with-tilde-followed-by-digit-%d',
65+
$digit,
66+
);
67+
68+
$value = \sprintf(
69+
'/foo~%d',
70+
$digit,
71+
);
72+
73+
yield $key => [
74+
$value,
75+
];
76+
}
6277
}
6378

6479
/**

test/Unit/ReferenceTokenTest.php

+21-5
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,31 @@ public function testFromJsonStringRejectsInvalidValue(string $value): void
4747
public function provideInvalidJsonStringValue(): \Generator
4848
{
4949
$values = [
50-
'property-with-unescaped-forward-slash' => 'foo/bar',
51-
'property-with-unescaped-tilde' => 'foo~bar',
50+
'property-with-slash-forward' => 'foo/bar',
51+
'property-with-tilde-followed-by-word' => 'foo~bar',
5252
];
5353

5454
foreach ($values as $key => $value) {
5555
yield $key => [
5656
$value,
5757
];
5858
}
59+
60+
foreach (\range(2, 9) as $digit) {
61+
$key = \sprintf(
62+
'property-with-tilde-followed-by-digit-%d',
63+
$digit,
64+
);
65+
66+
$value = \sprintf(
67+
'foo~%d',
68+
$digit,
69+
);
70+
71+
yield $key => [
72+
$value,
73+
];
74+
}
5975
}
6076

6177
/**
@@ -124,7 +140,7 @@ public function provideValueAndJsonStringValue(): \Generator
124140
"'",
125141
"'",
126142
],
127-
'slash-backwards' => [
143+
'slash-backward' => [
128144
'\\',
129145
'\\',
130146
],
@@ -168,11 +184,11 @@ public function provideValueAndJsonStringValue(): \Generator
168184
"foo'bar",
169185
"foo'bar",
170186
],
171-
'with-slash-backwards' => [
187+
'with-slash-backward' => [
172188
'foo\\bar',
173189
'foo\\bar',
174190
],
175-
'with-slash-forwards' => [
191+
'with-slash-forward' => [
176192
'foo/bar',
177193
'foo~1bar',
178194
],

0 commit comments

Comments
 (0)