summaryrefslogtreecommitdiff
path: root/json/tests/draft6
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2019-10-02 22:35:36 -0400
committerJulian Berman <Julian@GrayVines.com>2019-10-02 22:35:36 -0400
commit41d82453873a8ac5ad7ef9cf4e81ee0161fad6b3 (patch)
treee265d9a554016f271ed9e808bec2f3afd3262bfd /json/tests/draft6
parent98f8a66954d82e4d49010c48c8855c096bbd9677 (diff)
parent05fe96aa3669635a6f01359bf80a312002b4d7cd (diff)
downloadjsonschema-41d82453873a8ac5ad7ef9cf4e81ee0161fad6b3.tar.gz
Merge commit '05fe96aa3669635a6f01359bf80a312002b4d7cd'
* commit '05fe96aa3669635a6f01359bf80a312002b4d7cd': Squashed 'json/' changes from 2903943b..586515ef
Diffstat (limited to 'json/tests/draft6')
-rw-r--r--json/tests/draft6/optional/ecmascript-regex.json181
-rw-r--r--json/tests/draft6/uniqueItems.json84
2 files changed, 265 insertions, 0 deletions
diff --git a/json/tests/draft6/optional/ecmascript-regex.json b/json/tests/draft6/optional/ecmascript-regex.json
index 08dc936..81643f8 100644
--- a/json/tests/draft6/optional/ecmascript-regex.json
+++ b/json/tests/draft6/optional/ecmascript-regex.json
@@ -9,5 +9,186 @@
"valid": false
}
]
+ },
+ {
+ "description": "ECMA 262 regex converts \\a to ascii BEL",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\a$"
+ },
+ "tests": [
+ {
+ "description": "does not match",
+ "data": "\\a",
+ "valid": false
+ },
+ {
+ "description": "matches",
+ "data": "\u0007",
+ "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 ascii whitespace only",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\s$"
+ },
+ "tests": [
+ {
+ "description": "ASCII space matches",
+ "data": " ",
+ "valid": true
+ },
+ {
+ "description": "latin-1 non-breaking-space does not match (unlike e.g. Python)",
+ "data": "\\u00a0",
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "ECMA 262 \\S matches everything but ascii whitespace",
+ "schema": {
+ "type": "string",
+ "pattern": "^\\S$"
+ },
+ "tests": [
+ {
+ "description": "ASCII space does not match",
+ "data": " ",
+ "valid": false
+ },
+ {
+ "description": "latin-1 non-breaking-space matches (unlike e.g. Python)",
+ "data": "\\u00a0",
+ "valid": true
+ }
+ ]
}
]
diff --git a/json/tests/draft6/uniqueItems.json b/json/tests/draft6/uniqueItems.json
index 8885ed0..d312ad7 100644
--- a/json/tests/draft6/uniqueItems.json
+++ b/json/tests/draft6/uniqueItems.json
@@ -85,5 +85,89 @@
"valid": false
}
]
+ },
+ {
+ "description": "uniqueItems with an array of items",
+ "schema": {
+ "items": [{"type": "boolean"}, {"type": "boolean"}],
+ "uniqueItems": true
+ },
+ "tests": [
+ {
+ "description": "[false, true] from items array is valid",
+ "data": [false, true],
+ "valid": true
+ },
+ {
+ "description": "[true, false] from items array is valid",
+ "data": [true, false],
+ "valid": true
+ },
+ {
+ "description": "[false, false] from items array is not valid",
+ "data": [false, false],
+ "valid": false
+ },
+ {
+ "description": "[true, true] from items array is not valid",
+ "data": [true, true],
+ "valid": false
+ },
+ {
+ "description": "unique array extended from [false, true] is valid",
+ "data": [false, true, "foo", "bar"],
+ "valid": true
+ },
+ {
+ "description": "unique array extended from [true, false] is valid",
+ "data": [true, false, "foo", "bar"],
+ "valid": true
+ },
+ {
+ "description": "non-unique array extended from [false, true] is not valid",
+ "data": [false, true, "foo", "foo"],
+ "valid": false
+ },
+ {
+ "description": "non-unique array extended from [true, false] is not valid",
+ "data": [true, false, "foo", "foo"],
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "uniqueItems with an array of items and additionalItems=false",
+ "schema": {
+ "items": [{"type": "boolean"}, {"type": "boolean"}],
+ "uniqueItems": true,
+ "additionalItems": false
+ },
+ "tests": [
+ {
+ "description": "[false, true] from items array is valid",
+ "data": [false, true],
+ "valid": true
+ },
+ {
+ "description": "[true, false] from items array is valid",
+ "data": [true, false],
+ "valid": true
+ },
+ {
+ "description": "[false, false] from items array is not valid",
+ "data": [false, false],
+ "valid": false
+ },
+ {
+ "description": "[true, true] from items array is not valid",
+ "data": [true, true],
+ "valid": false
+ },
+ {
+ "description": "extra items are invalid even if unique",
+ "data": [false, true, null],
+ "valid": false
+ }
+ ]
}
]