Skip to content

Commit 1b43ffa

Browse files
committed
Partial IRI and IRI-reference test suite
These are just slightly changed versions of most of the URI and URI-reference test suites. I omitted a number of URI test cases, particularly of different sorts of schemes. It's not entirely clear to me what the scope of the test suite should be, and I just want to get something in place that hopefully someone with a deeper understanding of IRI-related challenges can enhance.
1 parent 9b020b8 commit 1b43ffa

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

tests/draft7/optional/format.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,93 @@
204204
}
205205
]
206206
},
207+
{
208+
"description": "validation of IRIs",
209+
"schema": {"format": "iri"},
210+
"tests": [
211+
{
212+
"description": "a valid IRI with anchor tag",
213+
"data": "http://ƒøø.ßår/?∂éœ=πîx#πîüx",
214+
"valid": true
215+
},
216+
{
217+
"description": "a valid IRI with anchor tag and parantheses",
218+
"data": "http://ƒøø.com/blah_(wîkïpédiå)_blah#ßité-1",
219+
"valid": true
220+
},
221+
{
222+
"description": "a valid IRI with URL-encoded stuff",
223+
"data": "http://ƒøø.ßår/?q=Test%20URL-encoded%20stuff",
224+
"valid": true
225+
},
226+
{
227+
"description": "a valid IRI with many special characters",
228+
"data": "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
229+
"valid": true
230+
},
231+
{
232+
"description": "a valid IRI based on IPv6",
233+
"data": "http://2001:0db8:85a3:0000:0000:8a2e:0370:7334",
234+
"valid": true
235+
},
236+
{
237+
"description": "an invalid relative IRI Reference",
238+
"data": "/abc",
239+
"valid": false
240+
},
241+
{
242+
"description": "an invalid IRI",
243+
"data": "\\\\WINDOWS\\filëßåré",
244+
"valid": false
245+
},
246+
{
247+
"description": "an invalid IRI though valid IRI reference",
248+
"data": "âππ",
249+
"valid": false
250+
}
251+
]
252+
},
253+
{
254+
"description": "validation of IRI References",
255+
"schema": {"format": "iri-reference"},
256+
"tests": [
257+
{
258+
"description": "a valid IRI",
259+
"data": "http://ƒøø.ßår/?∂éœ=πîx#πîüx",
260+
"valid": true
261+
},
262+
{
263+
"description": "a valid protocol-relative IRI Reference",
264+
"data": "//ƒøø.ßår/?∂éœ=πîx#πîüx",
265+
"valid": true
266+
},
267+
{
268+
"description": "a valid relative IRI Reference",
269+
"data": "/âππ",
270+
"valid": true
271+
},
272+
{
273+
"description": "an invalid IRI Reference",
274+
"data": "\\\\WINDOWS\\filëßåré",
275+
"valid": false
276+
},
277+
{
278+
"description": "a valid IRI Reference",
279+
"data": "âππ",
280+
"valid": true
281+
},
282+
{
283+
"description": "a valid IRI fragment",
284+
"data": "#ƒrägmênt",
285+
"valid": true
286+
},
287+
{
288+
"description": "an invalid IRI fragment",
289+
"data": "#ƒräg\\mênt",
290+
"valid": false
291+
}
292+
]
293+
},
207294
{
208295
"description": "format: uri-template",
209296
"schema": {

0 commit comments

Comments
 (0)