Skip to content

Commit 2d55450

Browse files
authored
Merge pull request #284 from Zac-HD/newlines
Add trailine-newline tests for $ pattern
2 parents 586515e + c8f8789 commit 2d55450

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

tests/draft2019-09/optional/ecmascript-regex.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@
1010
}
1111
]
1212
},
13+
{
14+
"description": "ECMA 262 regex $ does not match trailing newline",
15+
"schema": {
16+
"type": "string",
17+
"pattern": "^abc$"
18+
},
19+
"tests": [
20+
{
21+
"description": "matches in Python, but should not in jsonschema",
22+
"data": "abc\n",
23+
"valid": false
24+
},
25+
{
26+
"description": "should match",
27+
"data": "abc",
28+
"valid": true
29+
}
30+
]
31+
},
1332
{
1433
"description": "ECMA 262 regex converts \\a to ascii BEL",
1534
"schema": {

tests/draft4/optional/ecmascript-regex.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@
1010
}
1111
]
1212
},
13+
{
14+
"description": "ECMA 262 regex $ does not match trailing newline",
15+
"schema": {
16+
"type": "string",
17+
"pattern": "^abc$"
18+
},
19+
"tests": [
20+
{
21+
"description": "matches in Python, but should not in jsonschema",
22+
"data": "abc\n",
23+
"valid": false
24+
},
25+
{
26+
"description": "should match",
27+
"data": "abc",
28+
"valid": true
29+
}
30+
]
31+
},
1332
{
1433
"description": "ECMA 262 regex converts \\a to ascii BEL",
1534
"schema": {

tests/draft6/optional/ecmascript-regex.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@
1010
}
1111
]
1212
},
13+
{
14+
"description": "ECMA 262 regex $ does not match trailing newline",
15+
"schema": {
16+
"type": "string",
17+
"pattern": "^abc$"
18+
},
19+
"tests": [
20+
{
21+
"description": "matches in Python, but should not in jsonschema",
22+
"data": "abc\n",
23+
"valid": false
24+
},
25+
{
26+
"description": "should match",
27+
"data": "abc",
28+
"valid": true
29+
}
30+
]
31+
},
1332
{
1433
"description": "ECMA 262 regex converts \\a to ascii BEL",
1534
"schema": {

tests/draft7/optional/ecmascript-regex.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@
1010
}
1111
]
1212
},
13+
{
14+
"description": "ECMA 262 regex $ does not match trailing newline",
15+
"schema": {
16+
"type": "string",
17+
"pattern": "^abc$"
18+
},
19+
"tests": [
20+
{
21+
"description": "matches in Python, but should not in jsonschema",
22+
"data": "abc\n",
23+
"valid": false
24+
},
25+
{
26+
"description": "should match",
27+
"data": "abc",
28+
"valid": true
29+
}
30+
]
31+
},
1332
{
1433
"description": "ECMA 262 regex converts \\a to ascii BEL",
1534
"schema": {

0 commit comments

Comments
 (0)