Skip to content

Commit b6a6cb7

Browse files
test a malformed pattern
1 parent c3f4319 commit b6a6cb7

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed

tests/draft2019-09/pattern.json

+16
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,27 @@
4949
"description": "pattern is not anchored",
5050
"schema": {"pattern": "a+"},
5151
"tests": [
52+
{
53+
"description": "doesn't match a substring",
54+
"data": "xxyy",
55+
"valid": false
56+
},
5257
{
5358
"description": "matches a substring",
5459
"data": "xxaayy",
5560
"valid": true
5661
}
5762
]
63+
},
64+
{
65+
"description": "pattern is malformed",
66+
"schema": {"pattern": "hel{1,",
67+
"tests": [
68+
{
69+
"description": "invalid regex does not match",
70+
"data": "hello",
71+
"valid": false
72+
}
73+
]
5874
}
5975
]

tests/draft3/pattern.json

+16
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,27 @@
4949
"description": "pattern is not anchored",
5050
"schema": {"pattern": "a+"},
5151
"tests": [
52+
{
53+
"description": "doesn't match a substring",
54+
"data": "xxyy",
55+
"valid": false
56+
},
5257
{
5358
"description": "matches a substring",
5459
"data": "xxaayy",
5560
"valid": true
5661
}
5762
]
63+
},
64+
{
65+
"description": "pattern is malformed",
66+
"schema": {"pattern": "hel{1,",
67+
"tests": [
68+
{
69+
"description": "invalid regex does not match",
70+
"data": "hello",
71+
"valid": false
72+
}
73+
]
5874
}
5975
]

tests/draft4/pattern.json

+16
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,27 @@
4949
"description": "pattern is not anchored",
5050
"schema": {"pattern": "a+"},
5151
"tests": [
52+
{
53+
"description": "doesn't match a substring",
54+
"data": "xxyy",
55+
"valid": false
56+
},
5257
{
5358
"description": "matches a substring",
5459
"data": "xxaayy",
5560
"valid": true
5661
}
5762
]
63+
},
64+
{
65+
"description": "pattern is malformed",
66+
"schema": {"pattern": "hel{1,",
67+
"tests": [
68+
{
69+
"description": "invalid regex does not match",
70+
"data": "hello",
71+
"valid": false
72+
}
73+
]
5874
}
5975
]

tests/draft6/pattern.json

+16
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,27 @@
4949
"description": "pattern is not anchored",
5050
"schema": {"pattern": "a+"},
5151
"tests": [
52+
{
53+
"description": "doesn't match a substring",
54+
"data": "xxyy",
55+
"valid": false
56+
},
5257
{
5358
"description": "matches a substring",
5459
"data": "xxaayy",
5560
"valid": true
5661
}
5762
]
63+
},
64+
{
65+
"description": "pattern is malformed",
66+
"schema": {"pattern": "hel{1,",
67+
"tests": [
68+
{
69+
"description": "invalid regex does not match",
70+
"data": "hello",
71+
"valid": false
72+
}
73+
]
5874
}
5975
]

tests/draft7/pattern.json

+16
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,27 @@
4949
"description": "pattern is not anchored",
5050
"schema": {"pattern": "a+"},
5151
"tests": [
52+
{
53+
"description": "doesn't match a substring",
54+
"data": "xxyy",
55+
"valid": false
56+
},
5257
{
5358
"description": "matches a substring",
5459
"data": "xxaayy",
5560
"valid": true
5661
}
5762
]
63+
},
64+
{
65+
"description": "pattern is malformed",
66+
"schema": {"pattern": "hel{1,",
67+
"tests": [
68+
{
69+
"description": "invalid regex does not match",
70+
"data": "hello",
71+
"valid": false
72+
}
73+
]
5874
}
5975
]

0 commit comments

Comments
 (0)