Skip to content

Commit f40e3aa

Browse files
committed
Squashed 'json/' changes from 71f55b36b..361620ecf
361620ecf [355] Move non-BMP pattern tests to optional e1f870b1c Add "comment" to the tests bc68a6b80 Merge pull request #332 from jdesrosiers/unevaluated-tests ab9e3d5c5 2 is more than 1. 846dd7abd Draft 4 isn't the most widely used anymore thankfully. 16191632e A bit less informal language in the README. 6077b07e1 Update unevaluatedProperties and unevaluatedItems tests git-subtree-dir: json git-subtree-split: 361620ecf18b71883f8522cb4c7e95e3e0adcdce
1 parent d1a643b commit f40e3aa

20 files changed

+1343
-480
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Set up Python
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: 3.7
2222
- name: Install tox

README.md

+11-13
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ choice is still the job of the validator implementor.
1212
Structure of a Test
1313
-------------------
1414

15-
If you're going to use this suite, you need to know how tests are laid out. The
16-
tests are contained in the `tests` directory at the root of this repository.
15+
The tests in this suite are contained in the `tests` directory at the
16+
root of this repository.
1717

1818
Inside that directory is a subdirectory for each draft or version of the
19-
schema.
19+
specification.
2020

21-
If you look inside the draft directory, there are a number of `.json` files,
22-
which logically group a set of test cases together. Often the grouping is by
23-
property under test, but not always, especially within optional test files
24-
(discussed below).
21+
Inside each draft directory, there are a number of `.json` files, which
22+
logically group a set of test cases together. Often the grouping is by
23+
property under test, but not always, especially within optional test
24+
files (discussed below).
2525

2626
Inside each `.json` file is a single array containing objects. It's easiest to
2727
illustrate the structure of these with an example:
@@ -45,9 +45,10 @@ illustrate the structure of these with an example:
4545
}
4646
```
4747

48-
So a description, a schema, and some tests, where tests is an array containing
49-
one or more objects with descriptions, data, and a boolean indicating whether
50-
they should be valid or invalid.
48+
In short: a description, a schema under test, and some tests, where each
49+
test in the `tests` array is an objects with a description of the case
50+
itself, the instance under test, and a boolean indicating whether it
51+
should be valid or invalid.
5152

5253
Coverage
5354
--------
@@ -59,9 +60,6 @@ Draft 2019-09 support is under development. Contributions are very
5960
welcome, especially from implementers as they add support to their own
6061
implementations.
6162

62-
Bug fixes will be made as needed for draft-04 as it is still the most
63-
widely used, while draft-03 is long since deprecated.
64-
6563
If you see anything missing from the current supported drafts, or incorrect
6664
on any draft still accepting bug fixes, please file an issue or submit a PR.
6765

test-schema.json

+16-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111
"type": "string",
1212
"format": "uri"
1313
},
14-
"description": { "type": "string" },
14+
"description": {
15+
"description": "The test set description",
16+
"type": "string"
17+
},
18+
"comment": {
19+
"description": "Any additional comments about the test set",
20+
"type": "string"
21+
},
1522
"schema": {
1623
"description": "This should be a valid schema. This should be a ref to a meta-schema if schema keywords need testing."
1724
},
@@ -56,7 +63,14 @@
5663
"type": "string",
5764
"format": "uri"
5865
},
59-
"description": { "type": "string" },
66+
"description": {
67+
"description": "The test description",
68+
"type": "string"
69+
},
70+
"comment": {
71+
"description": "Any additional comments about the test",
72+
"type": "string"
73+
},
6074
"data": {},
6175
"valid": { "type": "boolean" },
6276
"output": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
[
2+
{
3+
"description": "Proper UTF-16 surrogate pair handling: pattern",
4+
"comment": "Optional because .Net doesn't correctly handle 32-bit Unicode characters",
5+
"schema": { "pattern": "^🐲*$" },
6+
"tests": [
7+
{
8+
"description": "matches empty",
9+
"data": "",
10+
"valid": true
11+
},
12+
{
13+
"description": "matches single",
14+
"data": "🐲",
15+
"valid": true
16+
},
17+
{
18+
"description": "matches two",
19+
"data": "🐲🐲",
20+
"valid": true
21+
},
22+
{
23+
"description": "doesn't match one",
24+
"data": "🐉",
25+
"valid": false
26+
},
27+
{
28+
"description": "doesn't match two",
29+
"data": "🐉🐉",
30+
"valid": false
31+
},
32+
{
33+
"description": "doesn't match one ASCII",
34+
"data": "D",
35+
"valid": false
36+
},
37+
{
38+
"description": "doesn't match two ASCII",
39+
"data": "DD",
40+
"valid": false
41+
}
42+
]
43+
},
44+
{
45+
"description": "Proper UTF-16 surrogate pair handling: patternProperties",
46+
"comment": "Optional because .Net doesn't correctly handle 32-bit Unicode characters",
47+
"schema": {
48+
"patternProperties": {
49+
"^🐲*$": {
50+
"type": "integer"
51+
}
52+
}
53+
},
54+
"tests": [
55+
{
56+
"description": "matches empty",
57+
"data": { "": 1 },
58+
"valid": true
59+
},
60+
{
61+
"description": "matches single",
62+
"data": { "🐲": 1 },
63+
"valid": true
64+
},
65+
{
66+
"description": "matches two",
67+
"data": { "🐲🐲": 1 },
68+
"valid": true
69+
},
70+
{
71+
"description": "doesn't match one",
72+
"data": { "🐲": "hello" },
73+
"valid": false
74+
},
75+
{
76+
"description": "doesn't match two",
77+
"data": { "🐲🐲": "hello" },
78+
"valid": false
79+
}
80+
]
81+
}
82+
]

tests/draft2019-09/pattern.json

-41
Original file line numberDiff line numberDiff line change
@@ -55,46 +55,5 @@
5555
"valid": true
5656
}
5757
]
58-
},
59-
{
60-
"description": "non-BMP, checks for proper surrogate pair handling for UTF-16",
61-
"schema": { "pattern": "^🐲*$" },
62-
"tests": [
63-
{
64-
"description": "matches empty",
65-
"data": "",
66-
"valid": true
67-
},
68-
{
69-
"description": "matches single",
70-
"data": "🐲",
71-
"valid": true
72-
},
73-
{
74-
"description": "matches two",
75-
"data": "🐲🐲",
76-
"valid": true
77-
},
78-
{
79-
"description": "doesn't match one",
80-
"data": "🐉",
81-
"valid": false
82-
},
83-
{
84-
"description": "doesn't match two",
85-
"data": "🐉🐉",
86-
"valid": false
87-
},
88-
{
89-
"description": "doesn't match one ASCII",
90-
"data": "D",
91-
"valid": false
92-
},
93-
{
94-
"description": "doesn't match two ASCII",
95-
"data": "DD",
96-
"valid": false
97-
}
98-
]
9958
}
10059
]

tests/draft2019-09/patternProperties.json

-37
Original file line numberDiff line numberDiff line change
@@ -147,42 +147,5 @@
147147
"valid": true
148148
}
149149
]
150-
},
151-
{
152-
"description": "non-BMP, checks for proper surrogate pair handling for UTF-16",
153-
"schema": {
154-
"patternProperties": {
155-
"^🐲*$": {
156-
"type": "integer"
157-
}
158-
}
159-
},
160-
"tests": [
161-
{
162-
"description": "matches empty",
163-
"data": { "": 1 },
164-
"valid": true
165-
},
166-
{
167-
"description": "matches single",
168-
"data": { "🐲": 1 },
169-
"valid": true
170-
},
171-
{
172-
"description": "matches two",
173-
"data": { "🐲🐲": 1 },
174-
"valid": true
175-
},
176-
{
177-
"description": "doesn't match one",
178-
"data": { "🐲": "hello" },
179-
"valid": false
180-
},
181-
{
182-
"description": "doesn't match two",
183-
"data": { "🐲🐲": "hello" },
184-
"valid": false
185-
}
186-
]
187150
}
188151
]

0 commit comments

Comments
 (0)