-
-
Notifications
You must be signed in to change notification settings - Fork 220
Fix ECMA 262 \Z and \z tests #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,46 @@ | |
"schema": { "format": "regex" }, | ||
"tests": [ | ||
{ | ||
"description": "ECMA 262 has no support for \\Z anchor from .NET", | ||
"description": "ECMA 262 has no support for \\Z anchor, but it's still a valid regex", | ||
"data": "^\\S(|(.|\\n)*\\S)\\Z", | ||
"valid": true | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "ECMA 262 regex non-compliance", | ||
"schema": { | ||
"type": "string", | ||
"pattern": "^x\\Z" | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "\\Z should match literal Z", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that
> /Z/.test('Z')
true
> /\Z/.test('Z')
true
> /Z/u.test('Z')
true
> /\Z/u.test('Z')
Thrown:
SyntaxError: Invalid regular expression: /\Z/: Invalid escape Moreover, other tests here imply that pattern matching should be run in unicode mode, which is incompatible with this test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you suggest the change, then? I was going by regex101.com. |
||
"data": "xZ", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "\\Z should not match end", | ||
"data": "x", | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "ECMA 262 regex non-compliance", | ||
"schema": { | ||
"type": "string", | ||
"pattern": "^x\\z" | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "\\z should match literal z", | ||
"data": "xz", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "\\z should not match end", | ||
"data": "x", | ||
ssilverman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"valid": false | ||
} | ||
] | ||
|
Uh oh!
There was an error while loading. Please reload this page.