Skip to content

Commit 5e785c1

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 fce9e9b commit 5e785c1

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,8 +4,46 @@
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, but it's still a valid regex",
88
"data": "^\\S(|(.|\\n)*\\S)\\Z",
9+
"valid": true
10+
}
11+
]
12+
},
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",
947
"valid": false
1048
}
1149
]

0 commit comments

Comments
 (0)