Add regular RegExp Unicode property escape tests (#1014)

Ref. https://github.com/mathiasbynens/unicode-property-escapes-tests/pull/8.
This commit is contained in:
Mathias Bynens 2017-05-01 19:25:51 +02:00 committed by Leo Balter
parent 09f01de87e
commit d5e1150325
372 changed files with 260 additions and 0 deletions

View File

@ -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");

View 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