json-schema-validator/test/JSON-Schema-Test-Suite/tests/draft7/optional/ecmascript-regex.json
2021-06-10 11:02:41 +02:00

293 lines
8.1 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[
{
"description": "ECMA 262 regex $ does not match trailing newline",
"schema": {
"type": "string",
"pattern": "^abc$"
},
"tests": [
{
"description": "matches in Python, but should not in jsonschema",
"data": "abc\n",
"valid": false
},
{
"description": "should match",
"data": "abc",
"valid": true
}
]
},
{
"description": "ECMA 262 regex converts \\t to horizontal tab",
"schema": {
"type": "string",
"pattern": "^\\t$"
},
"tests": [
{
"description": "does not match",
"data": "\\t",
"valid": false
},
{
"description": "matches",
"data": "\u0009",
"valid": true
}
]
},
{
"description": "ECMA 262 regex escapes control codes with \\c and upper letter",
"schema": {
"type": "string",
"pattern": "^\\cC$"
},
"tests": [
{
"description": "does not match",
"data": "\\cC",
"valid": false
},
{
"description": "matches",
"data": "\u0003",
"valid": true
}
]
},
{
"description": "ECMA 262 regex escapes control codes with \\c and lower letter",
"schema": {
"type": "string",
"pattern": "^\\cc$"
},
"tests": [
{
"description": "does not match",
"data": "\\cc",
"valid": false
},
{
"description": "matches",
"data": "\u0003",
"valid": true
}
]
},
{
"description": "ECMA 262 \\d matches ascii digits only",
"schema": {
"type": "string",
"pattern": "^\\d$"
},
"tests": [
{
"description": "ASCII zero matches",
"data": "0",
"valid": true
},
{
"description": "NKO DIGIT ZERO does not match (unlike e.g. Python)",
"data": "߀",
"valid": false
},
{
"description": "NKO DIGIT ZERO (as \\u escape) does not match",
"data": "\u07c0",
"valid": false
}
]
},
{
"description": "ECMA 262 \\D matches everything but ascii digits",
"schema": {
"type": "string",
"pattern": "^\\D$"
},
"tests": [
{
"description": "ASCII zero does not match",
"data": "0",
"valid": false
},
{
"description": "NKO DIGIT ZERO matches (unlike e.g. Python)",
"data": "߀",
"valid": true
},
{
"description": "NKO DIGIT ZERO (as \\u escape) matches",
"data": "\u07c0",
"valid": true
}
]
},
{
"description": "ECMA 262 \\w matches ascii letters only",
"schema": {
"type": "string",
"pattern": "^\\w$"
},
"tests": [
{
"description": "ASCII 'a' matches",
"data": "a",
"valid": true
},
{
"description": "latin-1 e-acute does not match (unlike e.g. Python)",
"data": "é",
"valid": false
}
]
},
{
"description": "ECMA 262 \\W matches everything but ascii letters",
"schema": {
"type": "string",
"pattern": "^\\W$"
},
"tests": [
{
"description": "ASCII 'a' does not match",
"data": "a",
"valid": false
},
{
"description": "latin-1 e-acute matches (unlike e.g. Python)",
"data": "é",
"valid": true
}
]
},
{
"description": "ECMA 262 \\s matches whitespace",
"schema": {
"type": "string",
"pattern": "^\\s$"
},
"tests": [
{
"description": "ASCII space matches",
"data": " ",
"valid": true
},
{
"description": "Character tabulation matches",
"data": "\t",
"valid": true
},
{
"description": "Line tabulation matches",
"data": "\u000b",
"valid": true
},
{
"description": "Form feed matches",
"data": "\u000c",
"valid": true
},
{
"description": "latin-1 non-breaking-space matches",
"data": "\u00a0",
"valid": true
},
{
"description": "zero-width whitespace matches",
"data": "\ufeff",
"valid": true
},
{
"description": "line feed matches (line terminator)",
"data": "\u000a",
"valid": true
},
{
"description": "paragraph separator matches (line terminator)",
"data": "\u2029",
"valid": true
},
{
"description": "EM SPACE matches (Space_Separator)",
"data": "\u2003",
"valid": true
},
{
"description": "Non-whitespace control does not match",
"data": "\u0001",
"valid": false
},
{
"description": "Non-whitespace does not match",
"data": "\u2013",
"valid": false
}
]
},
{
"description": "ECMA 262 \\S matches everything but whitespace",
"schema": {
"type": "string",
"pattern": "^\\S$"
},
"tests": [
{
"description": "ASCII space does not match",
"data": " ",
"valid": false
},
{
"description": "Character tabulation does not match",
"data": "\t",
"valid": false
},
{
"description": "Line tabulation does not match",
"data": "\u000b",
"valid": false
},
{
"description": "Form feed does not match",
"data": "\u000c",
"valid": false
},
{
"description": "latin-1 non-breaking-space does not match",
"data": "\u00a0",
"valid": false
},
{
"description": "zero-width whitespace does not match",
"data": "\ufeff",
"valid": false
},
{
"description": "line feed does not match (line terminator)",
"data": "\u000a",
"valid": false
},
{
"description": "paragraph separator does not match (line terminator)",
"data": "\u2029",
"valid": false
},
{
"description": "EM SPACE does not match (Space_Separator)",
"data": "\u2003",
"valid": false
},
{
"description": "Non-whitespace control matches",
"data": "\u0001",
"valid": true
},
{
"description": "Non-whitespace matches",
"data": "\u2013",
"valid": true
}
]
}
]