Add regular RegExp Unicode property escape tests#1014
Add regular RegExp Unicode property escape tests#1014leobalter merged 1 commit intotc39:masterfrom mathiasbynens:early-errors-property-escapes
Conversation
|
|
||
| /[\p{Hex}]/u; | ||
| assert( | ||
| /[\p{Hex}-\uFFFF]/u.test('-'), |
There was a problem hiding this comment.
This regular expression should result in a SyntaxError, because of step 1 in https://tc39.github.io/ecma262/#sec-runtime-semantics-characterrange-abstract-operation.
There was a problem hiding this comment.
@anba Your commit in tc39/ecma262@d898df2 replaced "If A does not contain exactly one character or B does not contain exactly one character, throw a SyntaxError exception." with "Assert: A and B each contain exactly one character.". Where is the error thrown now?
There was a problem hiding this comment.
It's now an early syntax error.
https://tc39.github.io/ecma262/#sec-patterns-static-semantics-early-errors
NonemptyClassRanges :: ClassAtom - ClassAtomClassRanges
- It is a Syntax Error if IsCharacterClass of the first ClassAtom is true or IsCharacterClass of the second ClassAtom is true.
A similar restriction is in place for " NonemptyClassRangesNoDash :: ClassAtomNoDash - ClassAtomClassRanges".
Annex B modifies the early syntax error for non-Unicode patterns in https://tc39.github.io/ecma262/#sec-patterns-static-semantics-early-errors-annexb.
There was a problem hiding this comment.
Thanks for confirming. I'll update this test accordingly and upstream it to Test262.
Ref. mathiasbynens/unicode-property-escapes-tests#8.