summaryrefslogtreecommitdiff
path: root/json/tests/draft3/patternProperties.json
diff options
context:
space:
mode:
authorJulian Berman <Julian+git@GrayVines.com>2012-10-30 21:11:17 -0400
committerJulian Berman <Julian+git@GrayVines.com>2012-10-30 21:11:17 -0400
commit42d694b5584362e7ae05fde51e2173a3f4fb331e (patch)
tree66e46d1dbd7189ed6e5d9097fa7d5a6f5c3e25c9 /json/tests/draft3/patternProperties.json
parent80939b83eb5eb7d5c375ecb13cec5d9f80edc18c (diff)
downloadjsonschema-42d694b5584362e7ae05fde51e2173a3f4fb331e.tar.gz
Use git subtree for JSON Test Suite
Diffstat (limited to 'json/tests/draft3/patternProperties.json')
-rw-r--r--json/tests/draft3/patternProperties.json74
1 files changed, 74 insertions, 0 deletions
diff --git a/json/tests/draft3/patternProperties.json b/json/tests/draft3/patternProperties.json
new file mode 100644
index 0000000..bc79250
--- /dev/null
+++ b/json/tests/draft3/patternProperties.json
@@ -0,0 +1,74 @@
+[
+ {
+ "description":
+ "patternProperties validates properties matching a regex",
+ "schema": {
+ "patternProperties": {
+ "f.*o": {"type": "integer"}
+ }
+ },
+ "tests": [
+ {
+ "description": "a single valid match is valid",
+ "data": {"foo": 1},
+ "valid": true
+ },
+ {
+ "description": "multiple valid matches is valid",
+ "data": {"foo": 1, "foooooo" : 2},
+ "valid": true
+ },
+ {
+ "description": "a single invalid match is invalid",
+ "data": {"foo": "bar", "fooooo": 2},
+ "valid": false
+ },
+ {
+ "description": "multiple invalid matches is invalid",
+ "data": {"foo": "bar", "foooooo" : "baz"},
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "multiple simulatneous patternProperties are validated",
+ "schema": {
+ "patternProperties": {
+ "a*": {"type": "integer"},
+ "aaa*": {"maximum": 20}
+ }
+ },
+ "tests": [
+ {
+ "description": "a single valid match is valid",
+ "data": {"a": 21},
+ "valid": true
+ },
+ {
+ "description": "a simultaneous match is valid",
+ "data": {"aaaa": 18},
+ "valid": true
+ },
+ {
+ "description": "multiple matches is valid",
+ "data": {"a": 21, "aaaa": 18},
+ "valid": true
+ },
+ {
+ "description": "an invalid due to one is invalid",
+ "data": {"a": "bar"},
+ "valid": false
+ },
+ {
+ "description": "an invalid due to the other is invalid",
+ "data": {"aaaa": 31},
+ "valid": false
+ },
+ {
+ "description": "an invalid due to both is invalid",
+ "data": {"aaa": "foo", "aaaa": 31},
+ "valid": false
+ }
+ ]
+ }
+]