Skip to content

Commit ab48e26

Browse files
committed
Update QueryTest to detect baselineFailed tests that now pass. Modify More Info link to point to the RFC for queries sourced from there.
1 parent 01b94a8 commit ab48e26

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/QueryTest.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ public function testQueries(
4848
): void {
4949
$results = null;
5050
$query = \ucwords(\str_replace('_', ' ', $id));
51-
$url = \sprintf('https://cburgmer.github.io/json-path-comparison/results/%s', $id);
51+
if (\str_starts_with($id, 'rfc_')) {
52+
$url = 'https://www.rfc-editor.org/rfc/rfc9535';
53+
} else {
54+
$url = \sprintf('https://cburgmer.github.io/json-path-comparison/results/%s', $id);
55+
}
5256

5357
// Avoid "This test did not perform any assertions"
5458
// but do not use markTestSkipped, to prevent unnecessary
@@ -69,6 +73,10 @@ public function testQueries(
6973
$results = \json_encode((new JSONPath(\json_decode($data, true)))->find($selector));
7074

7175
self::assertEquals($consensus, $results);
76+
77+
if (\in_array($id, self::$baselineFailedQueries, true)) {
78+
throw new \Exception("XFAIL test $id unexpectedly passed, update baselineFailedQueries.txt");
79+
}
7280
} catch (ExpectationFailedException $e) {
7381
try {
7482
// In some cases, the consensus is just disordered, while
@@ -92,10 +100,12 @@ public function testQueries(
92100
);
93101
}
94102
}
95-
} catch (JSONPathException $e) {
96-
// ignore
97-
} catch (RuntimeException) {
98-
// ignore
103+
} catch (JSONPathException|RuntimeException $e) {
104+
if (!\in_array($id, self::$baselineFailedQueries, true)) {
105+
throw new RuntimeException(
106+
$e->getMessage() . "\nQuery: {$query}\n\nMore information: {$url}",
107+
);
108+
}
99109
}
100110
}
101111

@@ -1576,7 +1586,7 @@ public static function queryDataProvider(): array
15761586
'[null]'
15771587
],
15781588
[
1579-
'rfc_semantics_of_null_existance',
1589+
'rfc_semantics_of_null_existence',
15801590
'$.b[?@]',
15811591
'{"a": null, "b": [null], "c": [{}], "null": 1}',
15821592
'[null]'

0 commit comments

Comments
 (0)