mirror of
https://github.com/tc39/test262.git
synced 2025-07-24 22:45:10 +02:00
Add regular RegExp Unicode property escape tests (#1014)
Ref. https://github.com/mathiasbynens/unicode-property-escapes-tests/pull/8.
This commit is contained in:
parent
09f01de87e
commit
d5e1150325
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright 2017 Mathias Bynens. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
author: Mathias Bynens
|
||||||
|
description: >
|
||||||
|
Binary properties with an explicit value must throw in Unicode property
|
||||||
|
escapes (even if the value is valid).
|
||||||
|
esid: sec-static-semantics-unicodematchproperty-p
|
||||||
|
features: [regexp-unicode-property-escapes]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.throws.early(SyntaxError, "/\\p{ASCII=Yes}/u");
|
||||||
|
assert.throws.early(SyntaxError, "/\\p{ASCII=Y}/u");
|
||||||
|
assert.throws.early(SyntaxError, "/\\p{ASCII=T}/u");
|
||||||
|
|
||||||
|
assert.throws.early(SyntaxError, "/\\P{ASCII=No}/u");
|
||||||
|
assert.throws.early(SyntaxError, "/\\P{ASCII=N}/u");
|
||||||
|
assert.throws.early(SyntaxError, "/\\P{ASCII=F}/u");
|
||||||
|
|
||||||
|
assert.throws.early(SyntaxError, "/\\p{ASCII=Invalid}/u");
|
25
test/built-ins/RegExp/property-escapes/character-class.js
Normal file
25
test/built-ins/RegExp/property-escapes/character-class.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2017 Mathias Bynens. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
author: Mathias Bynens
|
||||||
|
description: >
|
||||||
|
Unicode property escapes must be supported in character classes.
|
||||||
|
esid: sec-static-semantics-unicodematchproperty-p
|
||||||
|
features: [regexp-unicode-property-escapes]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
/[\p{Hex}]/u;
|
||||||
|
assert(
|
||||||
|
/[\p{Hex}-\uFFFF]/u.test('-'),
|
||||||
|
'property escape in character class should not be parsed as the start of a range'
|
||||||
|
);
|
||||||
|
assert.throws.early(SyntaxError, "/[\\p{}]/u");
|
||||||
|
assert.throws.early(SyntaxError, "/[\\p{invalid}]/u");
|
||||||
|
assert.throws.early(SyntaxError, "/[\\p{]/u");
|
||||||
|
assert.throws.early(SyntaxError, "/[\\p{]}/u");
|
||||||
|
assert.throws.early(SyntaxError, "/[\\p}]/u");
|
||||||
|
assert(
|
||||||
|
/[\p{Hex}\P{Hex}]/u.test('\u{1D306}'),
|
||||||
|
'multiple property escapes in a single character class should be supported'
|
||||||
|
);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user