From 00570e409e59e894f3d2373ebb3c9960b95a5f29 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Wed, 3 Jun 2020 09:26:23 -0700 Subject: [PATCH] test a malformed pattern --- tests/draft2019-09/pattern.json | 16 ++++++++++++++++ tests/draft3/pattern.json | 16 ++++++++++++++++ tests/draft4/pattern.json | 16 ++++++++++++++++ tests/draft6/pattern.json | 16 ++++++++++++++++ tests/draft7/pattern.json | 16 ++++++++++++++++ 5 files changed, 80 insertions(+) diff --git a/tests/draft2019-09/pattern.json b/tests/draft2019-09/pattern.json index 92db0f97..3a5d8e8d 100644 --- a/tests/draft2019-09/pattern.json +++ b/tests/draft2019-09/pattern.json @@ -49,11 +49,27 @@ "description": "pattern is not anchored", "schema": {"pattern": "a+"}, "tests": [ + { + "description": "doesn't match a substring", + "data": "xxyy", + "valid": false + }, { "description": "matches a substring", "data": "xxaayy", "valid": true } ] + }, + { + "description": "pattern is malformed", + "schema": {"pattern": "hel{1,"}, + "tests": [ + { + "description": "invalid regex does not match", + "data": "hello", + "valid": false + } + ] } ] diff --git a/tests/draft3/pattern.json b/tests/draft3/pattern.json index 92db0f97..3a5d8e8d 100644 --- a/tests/draft3/pattern.json +++ b/tests/draft3/pattern.json @@ -49,11 +49,27 @@ "description": "pattern is not anchored", "schema": {"pattern": "a+"}, "tests": [ + { + "description": "doesn't match a substring", + "data": "xxyy", + "valid": false + }, { "description": "matches a substring", "data": "xxaayy", "valid": true } ] + }, + { + "description": "pattern is malformed", + "schema": {"pattern": "hel{1,"}, + "tests": [ + { + "description": "invalid regex does not match", + "data": "hello", + "valid": false + } + ] } ] diff --git a/tests/draft4/pattern.json b/tests/draft4/pattern.json index 92db0f97..3a5d8e8d 100644 --- a/tests/draft4/pattern.json +++ b/tests/draft4/pattern.json @@ -49,11 +49,27 @@ "description": "pattern is not anchored", "schema": {"pattern": "a+"}, "tests": [ + { + "description": "doesn't match a substring", + "data": "xxyy", + "valid": false + }, { "description": "matches a substring", "data": "xxaayy", "valid": true } ] + }, + { + "description": "pattern is malformed", + "schema": {"pattern": "hel{1,"}, + "tests": [ + { + "description": "invalid regex does not match", + "data": "hello", + "valid": false + } + ] } ] diff --git a/tests/draft6/pattern.json b/tests/draft6/pattern.json index 92db0f97..3a5d8e8d 100644 --- a/tests/draft6/pattern.json +++ b/tests/draft6/pattern.json @@ -49,11 +49,27 @@ "description": "pattern is not anchored", "schema": {"pattern": "a+"}, "tests": [ + { + "description": "doesn't match a substring", + "data": "xxyy", + "valid": false + }, { "description": "matches a substring", "data": "xxaayy", "valid": true } ] + }, + { + "description": "pattern is malformed", + "schema": {"pattern": "hel{1,"}, + "tests": [ + { + "description": "invalid regex does not match", + "data": "hello", + "valid": false + } + ] } ] diff --git a/tests/draft7/pattern.json b/tests/draft7/pattern.json index 92db0f97..3a5d8e8d 100644 --- a/tests/draft7/pattern.json +++ b/tests/draft7/pattern.json @@ -49,11 +49,27 @@ "description": "pattern is not anchored", "schema": {"pattern": "a+"}, "tests": [ + { + "description": "doesn't match a substring", + "data": "xxyy", + "valid": false + }, { "description": "matches a substring", "data": "xxaayy", "valid": true } ] + }, + { + "description": "pattern is malformed", + "schema": {"pattern": "hel{1,"}, + "tests": [ + { + "description": "invalid regex does not match", + "data": "hello", + "valid": false + } + ] } ]