From cb6dfb2f040c1cc581128a0fbd2a40cfa44fb994 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Tue, 25 Sep 2012 16:11:21 -0400 Subject: [PATCH 1/3] Add cleaned up additionalItems --- tests/draft3/additionalItems.json | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/draft3/additionalItems.json diff --git a/tests/draft3/additionalItems.json b/tests/draft3/additionalItems.json new file mode 100644 index 00000000..f75e1a50 --- /dev/null +++ b/tests/draft3/additionalItems.json @@ -0,0 +1,66 @@ +[ + { + "description": "additionalItems as schema", + "schema": { + "additionalItems": {"type": "integer"} + }, + "tests": [ + { + "description": "all items match schema", + "data": [ 1, 2, 3, 4, 5 ], + "valid": true + }, + { + "description": "not all items match schema", + "data": [ 1, 2, 3, 4.4 ], + "valid": false + } + ] + }, + { + "description": "items is schema, no additionalItems", + "schema": { + "items": {}, + "additionalItems": false + }, + "tests": [ + { + "description": "all items match schema", + "data": [ 1, 2, 3, 4, 5 ], + "valid": true + } + ] + }, + { + "description": "array of items with no additionalItems", + "schema": { + "items": [{}, {}, {}], + "additionalItems": false + }, + "tests": [ + { + "description": "no additional items present", + "data": [ 1, 2, 3 ], + "valid": true + }, + { + "description": "additional items are not permitted", + "data": [ 1, 2, 3, 4 ], + "valid": false + } + ] + }, + { + "description": "additionalItems as false without items", + "schema": { + "additionalItems": false + }, + "tests": [ + { + "description": "items should allow anything", + "data": [ 1, 2, 3, 4, 5 ], + "valid": true + } + ] + } +] \ No newline at end of file From baf050206e12334dfe158390a9d8f8d5525b3d6d Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Tue, 25 Sep 2012 16:48:30 -0400 Subject: [PATCH 2/3] Added items tests. --- tests/draft3/items.json | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/draft3/items.json diff --git a/tests/draft3/items.json b/tests/draft3/items.json new file mode 100644 index 00000000..9e162633 --- /dev/null +++ b/tests/draft3/items.json @@ -0,0 +1,41 @@ +[ + { + "description": "a schema given for items", + "schema": { + "items": {"type": "integer"} + }, + "tests": [ + { + "description": "valid items", + "data": [ 1, 2, 3 ], + "valid": true + }, + { + "description": "wrong type of items", + "data": [1, "x"], + "valid": false + } + ] + }, + { + "description": "an array of schemas for items", + "schema": { + "items": [ + {"type": "integer"}, + {"type": "string"} + ] + }, + "tests": [ + { + "description": "correct types", + "data": [ 1, "foo" ], + "valid": true + }, + { + "description": "wrong types", + "data": [ "foo", 1 ], + "valid": false + } + ] + } +] \ No newline at end of file From 3498f34e94db6e20f8202c0638005d2f62931ab7 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Wed, 26 Sep 2012 20:02:58 -0400 Subject: [PATCH 3/3] Fix an improper additionalItems test. --- tests/draft3/additionalItems.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/draft3/additionalItems.json b/tests/draft3/additionalItems.json index f75e1a50..72ea449a 100644 --- a/tests/draft3/additionalItems.json +++ b/tests/draft3/additionalItems.json @@ -7,13 +7,8 @@ "tests": [ { "description": "all items match schema", - "data": [ 1, 2, 3, 4, 5 ], + "data": [ 1, 2, 3, 4.5, 5 ], "valid": true - }, - { - "description": "not all items match schema", - "data": [ 1, 2, 3, 4.4 ], - "valid": false } ] },