1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: B.1.4 is not applied for Unicode RegExp - ClassEscape in range expression
info: |
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
are not applied for Unicode RegExp.
Tested extension: "ClassAtomNoDashInRange :: \ ClassEscape but only if ClassEscape evaluates to a CharSet with exactly one character"
es6id: 21.2.2.15.1
---*/
// Leading CharacterClassEscape.
assert.throws(SyntaxError, function() {
RegExp("[\\d-a]", "u");
}, 'RegExp("[\\d-a]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\D-a]", "u");
}, 'RegExp("[\\D-a]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\s-a]", "u");
}, 'RegExp("[\\s-a]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\S-a]", "u");
}, 'RegExp("[\\S-a]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\w-a]", "u");
}, 'RegExp("[\\w-a]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\W-a]", "u");
}, 'RegExp("[\\W-a]", "u"): ');
// Trailing CharacterClassEscape.
assert.throws(SyntaxError, function() {
RegExp("[a-\\d]", "u");
}, 'RegExp("[a-\\d]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[a-\\D]", "u");
}, 'RegExp("[a-\\D]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[a-\\s]", "u");
}, 'RegExp("[a-\\s]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[a-\\S]", "u");
}, 'RegExp("[a-\\S]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[a-\\w]", "u");
}, 'RegExp("[a-\\w]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[a-\\W]", "u");
}, 'RegExp("[a-\\W]", "u"): ');
// Leading and trailing CharacterClassEscape.
assert.throws(SyntaxError, function() {
RegExp("[\\d-\\d]", "u");
}, 'RegExp("[\\d-\\d]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\D-\\D]", "u");
}, 'RegExp("[\\D-\\D]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\s-\\s]", "u");
}, 'RegExp("[\\s-\\s]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\S-\\S]", "u");
}, 'RegExp("[\\S-\\S]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\w-\\w]", "u");
}, 'RegExp("[\\w-\\w]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\W-\\W]", "u");
}, 'RegExp("[\\W-\\W]", "u"): ');
reportCompare(0, 0);
|