Fix test involving a Unicode property escape in a character class range (#1034)

Thanks to @anba for spotting this: 4843f049fa (r116528031)
This commit is contained in:
Mathias Bynens 2017-05-17 19:07:50 +02:00 committed by Leo Balter
parent a9fa392c11
commit d587abccdb
1 changed files with 5 additions and 3 deletions

View File

@ -10,9 +10,11 @@ features: [regexp-unicode-property-escapes]
---*/ ---*/
/[\p{Hex}]/u; /[\p{Hex}]/u;
assert( assert.throws(
/[\p{Hex}-\uFFFF]/u.test('-'), SyntaxError,
'property escape in character class should not be parsed as the start of a range' () => /[\p{Hex}-\uFFFF]/u,
// See step 1 of https://tc39.github.io/ecma262/#sec-runtime-semantics-characterrange-abstract-operation.
'property escape at start of character class range should throw if it expands to multiple characters'
); );
assert.throws.early(SyntaxError, "/[\\p{}]/u"); assert.throws.early(SyntaxError, "/[\\p{}]/u");
assert.throws.early(SyntaxError, "/[\\p{invalid}]/u"); assert.throws.early(SyntaxError, "/[\\p{invalid}]/u");