mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Regenerate character class escape tests
This commit is contained in:
parent
05fbae4993
commit
3f10507650
@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for digit class escape \d with flags g
|
||||
Check negative cases of digit class escape \d.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
@ -45,22 +46,32 @@ includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
],
|
||||
});
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x00DBFF],
|
||||
[0x00E000, 0x10FFFF]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const re = /\d/g;
|
||||
const standard = /\d/;
|
||||
const unicode = /\d/u;
|
||||
const vflag = /\d/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
for (const regex of regexes) {
|
||||
if (regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,5 +79,5 @@ if (!re.test(str)) {
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
'Expected no match, but matched: ' + errors.join(',')
|
||||
);
|
@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for digit class escape \d+ with flags ug
|
||||
Check positive cases of digit class escape \d.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
@ -45,22 +46,29 @@ includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
],
|
||||
});
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x000030, 0x000039]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const re = /\d+/ug;
|
||||
const standard = /^\d+$/;
|
||||
const unicode = /^\d+$/u;
|
||||
const vflag = /^\d+$/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
for (const regex of regexes) {
|
||||
if (!regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,5 +76,5 @@ if (!re.test(str)) {
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
'Expected full match, but did not match: ' + errors.join(',')
|
||||
);
|
@ -1,75 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-digit class escape \D with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x00DBFF],
|
||||
[0x00E000, 0x10FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\D/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for digit class escape \d with flags ug
|
||||
Check negative cases of non-digit class escape \D.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
@ -45,22 +46,29 @@ includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
],
|
||||
});
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x000030, 0x000039]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const re = /\d/ug;
|
||||
const standard = /\D/;
|
||||
const unicode = /\D/u;
|
||||
const vflag = /\D/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
for (const regex of regexes) {
|
||||
if (regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,5 +76,5 @@ if (!re.test(str)) {
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
'Expected no match, but matched: ' + errors.join(',')
|
||||
);
|
@ -1,75 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-digit class escape \D+ with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x00DBFF],
|
||||
[0x00E000, 0x10FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\D+/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,75 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-digit class escape \D+ with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x00DBFF],
|
||||
[0x00E000, 0x00FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\D+/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -0,0 +1,83 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Check positive cases of non-digit class escape \D.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x00DBFF],
|
||||
[0x00E000, 0x10FFFF]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const standard = /^\D+$/;
|
||||
const unicode = /^\D+$/u;
|
||||
const vflag = /^\D+$/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
for (const regex of regexes) {
|
||||
if (!regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected full match, but did not match: ' + errors.join(',')
|
||||
);
|
@ -1,75 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-digit class escape \D with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x00DBFF],
|
||||
[0x00E000, 0x00FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\D/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,84 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-whitespace class escape \S with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x000008],
|
||||
[0x00000E, 0x00001F],
|
||||
[0x000021, 0x00009F],
|
||||
[0x0000A1, 0x00167F],
|
||||
[0x001681, 0x001FFF],
|
||||
[0x00200B, 0x002027],
|
||||
[0x00202A, 0x00202E],
|
||||
[0x002030, 0x00205E],
|
||||
[0x002060, 0x002FFF],
|
||||
[0x003001, 0x00DBFF],
|
||||
[0x00E000, 0x00FEFE],
|
||||
[0x00FF00, 0x10FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\S/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -0,0 +1,90 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Check negative cases of non-whitespace class escape \S.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [
|
||||
0x000020,
|
||||
0x0000A0,
|
||||
0x001680,
|
||||
0x00202F,
|
||||
0x00205F,
|
||||
0x003000,
|
||||
0x00FEFF
|
||||
],
|
||||
ranges: [
|
||||
[0x000009, 0x00000D],
|
||||
[0x002000, 0x00200A],
|
||||
[0x002028, 0x002029]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const standard = /\S/;
|
||||
const unicode = /\S/u;
|
||||
const vflag = /\S/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
for (const regex of regexes) {
|
||||
if (regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected no match, but matched: ' + errors.join(',')
|
||||
);
|
@ -1,84 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-whitespace class escape \S+ with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x000008],
|
||||
[0x00000E, 0x00001F],
|
||||
[0x000021, 0x00009F],
|
||||
[0x0000A1, 0x00167F],
|
||||
[0x001681, 0x001FFF],
|
||||
[0x00200B, 0x002027],
|
||||
[0x00202A, 0x00202E],
|
||||
[0x002030, 0x00205E],
|
||||
[0x002060, 0x002FFF],
|
||||
[0x003001, 0x00DBFF],
|
||||
[0x00E000, 0x00FEFE],
|
||||
[0x00FF00, 0x10FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\S+/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,84 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-whitespace class escape \S+ with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x000008],
|
||||
[0x00000E, 0x00001F],
|
||||
[0x000021, 0x00009F],
|
||||
[0x0000A1, 0x00167F],
|
||||
[0x001681, 0x001FFF],
|
||||
[0x00200B, 0x002027],
|
||||
[0x00202A, 0x00202E],
|
||||
[0x002030, 0x00205E],
|
||||
[0x002060, 0x002FFF],
|
||||
[0x003001, 0x00DBFF],
|
||||
[0x00E000, 0x00FEFE],
|
||||
[0x00FF00, 0x00FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\S+/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -0,0 +1,92 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Check positive cases of non-whitespace class escape \S.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x000008],
|
||||
[0x00000E, 0x00001F],
|
||||
[0x000021, 0x00009F],
|
||||
[0x0000A1, 0x00167F],
|
||||
[0x001681, 0x001FFF],
|
||||
[0x00200B, 0x002027],
|
||||
[0x00202A, 0x00202E],
|
||||
[0x002030, 0x00205E],
|
||||
[0x002060, 0x002FFF],
|
||||
[0x003001, 0x00DBFF],
|
||||
[0x00E000, 0x00FEFE],
|
||||
[0x00FF00, 0x10FFFF]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const standard = /^\S+$/;
|
||||
const unicode = /^\S+$/u;
|
||||
const vflag = /^\S+$/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
for (const regex of regexes) {
|
||||
if (!regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected full match, but did not match: ' + errors.join(',')
|
||||
);
|
@ -1,84 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-whitespace class escape \S with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x000008],
|
||||
[0x00000E, 0x00001F],
|
||||
[0x000021, 0x00009F],
|
||||
[0x0000A1, 0x00167F],
|
||||
[0x001681, 0x001FFF],
|
||||
[0x00200B, 0x002027],
|
||||
[0x00202A, 0x00202E],
|
||||
[0x002030, 0x00205E],
|
||||
[0x002060, 0x002FFF],
|
||||
[0x003001, 0x00DBFF],
|
||||
[0x00E000, 0x00FEFE],
|
||||
[0x00FF00, 0x00FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\S/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-word class escape \W with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [0x000060],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x000040],
|
||||
[0x00005B, 0x00005E],
|
||||
[0x00007B, 0x00DBFF],
|
||||
[0x00E000, 0x10FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\W/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for digit class escape \d+ with flags g
|
||||
Check negative cases of non-word class escape \W.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
@ -45,22 +46,33 @@ includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
],
|
||||
});
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [
|
||||
0x00005F
|
||||
],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
[0x000041, 0x00005A],
|
||||
[0x000061, 0x00007A]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const re = /\d+/g;
|
||||
const standard = /\W/;
|
||||
const unicode = /\W/u;
|
||||
const vflag = /\W/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
for (const regex of regexes) {
|
||||
if (regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,5 +80,5 @@ if (!re.test(str)) {
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
'Expected no match, but matched: ' + errors.join(',')
|
||||
);
|
@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-word class escape \W+ with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [0x000060],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x000040],
|
||||
[0x00005B, 0x00005E],
|
||||
[0x00007B, 0x00DBFF],
|
||||
[0x00E000, 0x10FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\W+/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-word class escape \W+ with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [0x000060],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x000040],
|
||||
[0x00005B, 0x00005E],
|
||||
[0x00007B, 0x00DBFF],
|
||||
[0x00E000, 0x00FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\W+/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -0,0 +1,87 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Check positive cases of non-word class escape \W.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [
|
||||
0x000060
|
||||
],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x000040],
|
||||
[0x00005B, 0x00005E],
|
||||
[0x00007B, 0x00DBFF],
|
||||
[0x00E000, 0x10FFFF]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const standard = /^\W+$/;
|
||||
const unicode = /^\W+$/u;
|
||||
const vflag = /^\W+$/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
for (const regex of regexes) {
|
||||
if (!regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected full match, but did not match: ' + errors.join(',')
|
||||
);
|
@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for non-word class escape \W with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [0x000060],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x000040],
|
||||
[0x00005B, 0x00005E],
|
||||
[0x00007B, 0x00DBFF],
|
||||
[0x00E000, 0x00FFFF],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\W/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,82 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for whitespace class escape \s with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [
|
||||
0x000020,
|
||||
0x0000A0,
|
||||
0x001680,
|
||||
0x00202F,
|
||||
0x00205F,
|
||||
0x003000,
|
||||
0x00FEFF,
|
||||
],
|
||||
ranges: [
|
||||
[0x000009, 0x00000D],
|
||||
[0x002000, 0x00200A],
|
||||
[0x002028, 0x002029],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\s/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -0,0 +1,92 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Check negative cases of whitespace class escape \s.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x000008],
|
||||
[0x00000E, 0x00001F],
|
||||
[0x000021, 0x00009F],
|
||||
[0x0000A1, 0x00167F],
|
||||
[0x001681, 0x001FFF],
|
||||
[0x00200B, 0x002027],
|
||||
[0x00202A, 0x00202E],
|
||||
[0x002030, 0x00205E],
|
||||
[0x002060, 0x002FFF],
|
||||
[0x003001, 0x00DBFF],
|
||||
[0x00E000, 0x00FEFE],
|
||||
[0x00FF00, 0x10FFFF]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const standard = /\s/;
|
||||
const unicode = /\s/u;
|
||||
const vflag = /\s/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
for (const regex of regexes) {
|
||||
if (regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected no match, but matched: ' + errors.join(',')
|
||||
);
|
@ -1,82 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for whitespace class escape \s+ with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [
|
||||
0x000020,
|
||||
0x0000A0,
|
||||
0x001680,
|
||||
0x00202F,
|
||||
0x00205F,
|
||||
0x003000,
|
||||
0x00FEFF,
|
||||
],
|
||||
ranges: [
|
||||
[0x000009, 0x00000D],
|
||||
[0x002000, 0x00200A],
|
||||
[0x002028, 0x002029],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\s+/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,82 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for whitespace class escape \s+ with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [
|
||||
0x000020,
|
||||
0x0000A0,
|
||||
0x001680,
|
||||
0x00202F,
|
||||
0x00205F,
|
||||
0x003000,
|
||||
0x00FEFF,
|
||||
],
|
||||
ranges: [
|
||||
[0x000009, 0x00000D],
|
||||
[0x002000, 0x00200A],
|
||||
[0x002028, 0x002029],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\s+/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -0,0 +1,90 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Check positive cases of whitespace class escape \s.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [
|
||||
0x000020,
|
||||
0x0000A0,
|
||||
0x001680,
|
||||
0x00202F,
|
||||
0x00205F,
|
||||
0x003000,
|
||||
0x00FEFF
|
||||
],
|
||||
ranges: [
|
||||
[0x000009, 0x00000D],
|
||||
[0x002000, 0x00200A],
|
||||
[0x002028, 0x002029]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const standard = /^\s+$/;
|
||||
const unicode = /^\s+$/u;
|
||||
const vflag = /^\s+$/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
for (const regex of regexes) {
|
||||
if (!regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected full match, but did not match: ' + errors.join(',')
|
||||
);
|
@ -1,82 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for whitespace class escape \s with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [
|
||||
0x000020,
|
||||
0x0000A0,
|
||||
0x001680,
|
||||
0x00202F,
|
||||
0x00205F,
|
||||
0x003000,
|
||||
0x00FEFF,
|
||||
],
|
||||
ranges: [
|
||||
[0x000009, 0x00000D],
|
||||
[0x002000, 0x00200A],
|
||||
[0x002028, 0x002029],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\s/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,74 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for word class escape \w with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [0x00005F],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
[0x000041, 0x00005A],
|
||||
[0x000061, 0x00007A],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\w/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -0,0 +1,87 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Check negative cases of word class escape \w.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [
|
||||
0x000060
|
||||
],
|
||||
ranges: [
|
||||
[0x00DC00, 0x00DFFF],
|
||||
[0x000000, 0x00002F],
|
||||
[0x00003A, 0x000040],
|
||||
[0x00005B, 0x00005E],
|
||||
[0x00007B, 0x00DBFF],
|
||||
[0x00E000, 0x10FFFF]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const standard = /\w/;
|
||||
const unicode = /\w/u;
|
||||
const vflag = /\w/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
for (const regex of regexes) {
|
||||
if (regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected no match, but matched: ' + errors.join(',')
|
||||
);
|
@ -1,74 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for word class escape \w+ with flags ug
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [0x00005F],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
[0x000041, 0x00005A],
|
||||
[0x000061, 0x00007A],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\w+/ug;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -1,74 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for word class escape \w+ with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [0x00005F],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
[0x000041, 0x00005A],
|
||||
[0x000061, 0x00007A],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\w+/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
@ -0,0 +1,84 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// Copyright (C) 2024 Aurèle Barrière. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Check positive cases of word class escape \w.
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString(
|
||||
{
|
||||
loneCodePoints: [
|
||||
0x00005F
|
||||
],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
[0x000041, 0x00005A],
|
||||
[0x000061, 0x00007A]
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const standard = /^\w+$/;
|
||||
const unicode = /^\w+$/u;
|
||||
const vflag = /^\w+$/v;
|
||||
const regexes = [standard,unicode,vflag];
|
||||
|
||||
const errors = [];
|
||||
|
||||
for (const regex of regexes) {
|
||||
if (!regex.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!regex.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected full match, but did not match: ' + errors.join(',')
|
||||
);
|
@ -1,74 +0,0 @@
|
||||
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-CharacterClassEscape
|
||||
description: >
|
||||
Compare range for word class escape \w with flags g
|
||||
info: |
|
||||
This is a generated test. Please check out
|
||||
https://github.com/tc39/test262/tree/main/tools/regexp-generator/
|
||||
for any changes.
|
||||
|
||||
CharacterClassEscape[UnicodeMode] ::
|
||||
d
|
||||
D
|
||||
s
|
||||
S
|
||||
w
|
||||
W
|
||||
[+UnicodeMode] p{ UnicodePropertyValueExpression }
|
||||
[+UnicodeMode] P{ UnicodePropertyValueExpression }
|
||||
|
||||
22.2.2.9 Runtime Semantics: CompileToCharSet
|
||||
|
||||
CharacterClassEscape :: d
|
||||
1. Return the ten-element CharSet containing the characters 0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, and 9.
|
||||
CharacterClassEscape :: D
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: d.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: s
|
||||
1. Return the CharSet containing all characters corresponding to a code
|
||||
point on the right-hand side of the WhiteSpace or LineTerminator
|
||||
productions.
|
||||
CharacterClassEscape :: S
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: s.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
CharacterClassEscape :: w
|
||||
1. Return MaybeSimpleCaseFolding(rer, WordCharacters(rer)).
|
||||
CharacterClassEscape :: W
|
||||
1. Let S be the CharSet returned by CharacterClassEscape :: w.
|
||||
2. Return CharacterComplement(rer, S).
|
||||
features: [String.fromCodePoint]
|
||||
includes: [regExpUtils.js]
|
||||
flags: [generated]
|
||||
---*/
|
||||
|
||||
const str = buildString({
|
||||
loneCodePoints: [0x00005F],
|
||||
ranges: [
|
||||
[0x000030, 0x000039],
|
||||
[0x000041, 0x00005A],
|
||||
[0x000061, 0x00007A],
|
||||
],
|
||||
});
|
||||
|
||||
const re = /\w/g;
|
||||
|
||||
const errors = [];
|
||||
|
||||
if (!re.test(str)) {
|
||||
// Error, let's find out where
|
||||
for (const char of str) {
|
||||
if (!re.test(char)) {
|
||||
errors.push('0x' + char.codePointAt(0).toString(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert.sameValue(
|
||||
errors.length,
|
||||
0,
|
||||
'Expected matching code points, but received: ' + errors.join(',')
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user