Skip to content

Commit ae1d21f

Browse files
committed
Fix ECMA 262 \Z and \z tests
The old test was incorrect because "\Z" is actually valid. It matches a literal Z in ECMA 262.
1 parent 86f52b8 commit ae1d21f

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

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

+39-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,50 @@
44
"schema": { "format": "regex" },
55
"tests": [
66
{
7-
"description": "ECMA 262 has no support for \\Z anchor from .NET",
7+
"description": "ECMA 262 has no support for \\Z anchor",
88
"data": "^\\S(|(.|\\n)*\\S)\\Z",
99
"valid": false
1010
}
1111
]
1212
},
13+
{
14+
"description": "ECMA 262 regex non-compliance",
15+
"schema": {
16+
"type": "string",
17+
"pattern": "^x\\Z"
18+
},
19+
"tests": [
20+
{
21+
"description": "\\Z should match literal Z",
22+
"data": "xZ",
23+
"valid": true
24+
},
25+
{
26+
"description": "\\Z should not match end",
27+
"data": "x",
28+
"valid": false
29+
}
30+
]
31+
},
32+
{
33+
"description": "ECMA 262 regex non-compliance",
34+
"schema": {
35+
"type": "string",
36+
"pattern": "^x\\z"
37+
},
38+
"tests": [
39+
{
40+
"description": "\\z should match literal z",
41+
"data": "xz",
42+
"valid": true
43+
},
44+
{
45+
"description": "\\z should not match end",
46+
"data": "x",
47+
"valid": false
48+
}
49+
]
50+
},
1351
{
1452
"description": "ECMA 262 regex $ does not match trailing newline",
1553
"schema": {

0 commit comments

Comments
 (0)