diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js deleted file mode 100644 index de3c16f4e54..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js +++ /dev/null @@ -1,64 +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 digit class escape \d with flags ug -info: | - This is a generated test. Please check out - https://github.com/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -const str = buildString({ - loneCodePoints: [], - ranges: [ - [0x0030, 0x0039], - ], -}); - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js deleted file mode 100644 index 1c6462e7666..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js +++ /dev/null @@ -1,64 +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 digit class escape \d+ with flags ug -info: | - This is a generated test. Please check out - https://github.com/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -const str = buildString({ - loneCodePoints: [], - ranges: [ - [0x0030, 0x0039], - ], -}); - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js deleted file mode 100644 index 66418758b7b..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js +++ /dev/null @@ -1,64 +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 digit class escape \d+ with flags g -info: | - This is a generated test. Please check out - https://github.com/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -const str = buildString({ - loneCodePoints: [], - ranges: [ - [0x0030, 0x0039], - ], -}); - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js deleted file mode 100644 index 090e5a7e9a5..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js +++ /dev/null @@ -1,64 +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 digit class escape \d with flags g -info: | - This is a generated test. Please check out - https://github.com/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -const str = buildString({ - loneCodePoints: [], - ranges: [ - [0x0030, 0x0039], - ], -}); - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-negative-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-negative-cases.js new file mode 100644 index 00000000000..61f092a2ba4 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-negative-cases.js @@ -0,0 +1,47 @@ +// 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 that none of the non-digit characters are matched by \d. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: d evaluates as follows: + Return the ten-element set of characters containing the characters 0 through 9 inclusive. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [], + ranges: [ + [0x000000, 0x00002F], + [0x00003A, 0x10FFFF], + ], +}); + +const re = /\d/; +const re_u = /\d/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-positive-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-positive-cases.js new file mode 100644 index 00000000000..6157ea31311 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-digit-positive-cases.js @@ -0,0 +1,46 @@ +// 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 that all digit characters are matched by \d. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: d evaluates as follows: + Return the ten-element set of characters containing the characters 0 through 9 inclusive. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [], + ranges: [ + [0x0030, 0x0039], + ], +}); + +const re = /^\d+$/; +const re_u = /^\d+$/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js deleted file mode 100644 index e9385c00043..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js +++ /dev/null @@ -1,65 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -const str = buildString({ - loneCodePoints: [], - ranges: [ - [0x000000, 0x00002F], - [0x00003A, 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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js deleted file mode 100644 index bf534de854a..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js +++ /dev/null @@ -1,65 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -const str = buildString({ - loneCodePoints: [], - ranges: [ - [0x000000, 0x00002F], - [0x00003A, 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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js deleted file mode 100644 index 0c2c703ae8d..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js +++ /dev/null @@ -1,65 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -const str = buildString({ - loneCodePoints: [], - ranges: [ - [0x000000, 0x00002F], - [0x00003A, 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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js deleted file mode 100644 index ac626beb49c..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js +++ /dev/null @@ -1,65 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -const str = buildString({ - loneCodePoints: [], - ranges: [ - [0x000000, 0x00002F], - [0x00003A, 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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-negative-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-negative-cases.js new file mode 100644 index 00000000000..6ec5b140de5 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-negative-cases.js @@ -0,0 +1,48 @@ +// 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 that none of the digit characters are matched by \D. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: d evaluates as follows: + Return the ten-element set of characters containing the characters 0 through 9 inclusive. + The production CharacterClassEscape :: D evaluates as follows: + Return the set of all characters not included in the set returned by CharacterClassEscape :: d. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [], + ranges: [ + [0x0030, 0x0039], + ], +}); + +const re = /\D/; +const re_u = /\D/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-positive-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-positive-cases.js new file mode 100644 index 00000000000..b4a2a2a1f84 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-positive-cases.js @@ -0,0 +1,49 @@ +// 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 that all non-digit characters are matched by \D. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: d evaluates as follows: + Return the ten-element set of characters containing the characters 0 through 9 inclusive. + The production CharacterClassEscape :: D evaluates as follows: + Return the set of all characters not included in the set returned by CharacterClassEscape :: d. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [], + ranges: [ + [0x000000, 0x00002F], + [0x00003A, 0x10FFFF], + ], +}); + +const re = /^\D+$/; +const re_u = /^\D+$/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js deleted file mode 100644 index d635f47092d..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js +++ /dev/null @@ -1,76 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js deleted file mode 100644 index 1275d209c9e..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js +++ /dev/null @@ -1,76 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js deleted file mode 100644 index f70d16c78f7..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js +++ /dev/null @@ -1,76 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js deleted file mode 100644 index a605b0b132c..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js +++ /dev/null @@ -1,76 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-negative-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-negative-cases.js new file mode 100644 index 00000000000..aa5ed943d40 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-negative-cases.js @@ -0,0 +1,59 @@ +// 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 that none of the whitespace characters are matched by \S. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: s evaluates as follows: + Return the set of characters containing the characters that are on the right-hand side of + the WhiteSpace or LineTerminator productions. + The production CharacterClassEscape :: S evaluates as follows: + Return the set of all characters not included in the set returned by CharacterClassEscape :: s. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [ + 0x000020, + 0x0000A0, + 0x001680, + 0x00202F, + 0x00205F, + 0x003000, + 0x00FEFF, + ], + ranges: [ + [0x000009, 0x00000D], + [0x002000, 0x00200A], + [0x002028, 0x002029], + ], +}); + +const re = /\S/; +const re_u = /\S/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-positive-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-positive-cases.js new file mode 100644 index 00000000000..acec11fce27 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-positive-cases.js @@ -0,0 +1,61 @@ +// 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 that all non-whitespace characters are matched by \S. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: s evaluates as follows: + Return the set of characters containing the characters that are on the right-hand side of + the WhiteSpace or LineTerminator productions. + The production CharacterClassEscape :: S evaluates as follows: + Return the set of all characters not included in the set returned by CharacterClassEscape :: s. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +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+$/; +const re_u = /^\S+$/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js deleted file mode 100644 index 9eb98145d15..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js +++ /dev/null @@ -1,69 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js deleted file mode 100644 index 080aeec12f3..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js +++ /dev/null @@ -1,69 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js deleted file mode 100644 index 8b04bdf9270..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js +++ /dev/null @@ -1,69 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js deleted file mode 100644 index 477df9f72e5..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js +++ /dev/null @@ -1,69 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-negative-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-negative-cases.js new file mode 100644 index 00000000000..702ea0aca1c --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-negative-cases.js @@ -0,0 +1,50 @@ +// 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 that none of the word characters are matched by \W. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: w evaluates as follows: + Return the set of all characters returned by WordCharacters(). + The production CharacterClassEscape :: W evaluates as follows: + Return the set of all characters not included in the set returned by CharacterClassEscape :: w. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [0x00005F], + ranges: [ + [0x000030, 0x000039], + [0x000041, 0x00005A], + [0x000061, 0x00007A], + ], +}); + +const re = /\W/; +const re_u = /\W/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-positive-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-positive-cases.js new file mode 100644 index 00000000000..f76fed1062c --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-positive-cases.js @@ -0,0 +1,53 @@ +// 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 that all non-word characters are matched by \W. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: w evaluates as follows: + Return the set of all characters returned by WordCharacters(). + The production CharacterClassEscape :: W evaluates as follows: + Return the set of all characters not included in the set returned by CharacterClassEscape :: w. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [0x000060], + ranges: [ + [0x00DC00, 0x00DFFF], + [0x000000, 0x00002F], + [0x00003A, 0x000040], + [0x00005B, 0x00005E], + [0x00007B, 0x00DBFF], + [0x00E000, 0x10FFFF], + ], +}); + +const re = /^\W+$/; +const re_u = /^\W+$/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js deleted file mode 100644 index 185e25dcb26..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js +++ /dev/null @@ -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 whitespace class escape \s with flags ug -info: | - This is a generated test. Please check out - https://github.com/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js deleted file mode 100644 index 1a9bdf0d7f6..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js +++ /dev/null @@ -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 whitespace class escape \s+ with flags ug -info: | - This is a generated test. Please check out - https://github.com/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js deleted file mode 100644 index 0d10492a9ee..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js +++ /dev/null @@ -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 whitespace class escape \s+ with flags g -info: | - This is a generated test. Please check out - https://github.com/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js deleted file mode 100644 index 1d024382a5e..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js +++ /dev/null @@ -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 whitespace class escape \s with flags g -info: | - This is a generated test. Please check out - https://github.com/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-negative-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-negative-cases.js new file mode 100644 index 00000000000..0907e00fb22 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-negative-cases.js @@ -0,0 +1,59 @@ +// 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 that none of the non-whitespace characters are matched by \s. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: s evaluates as follows: + Return the set of characters containing the characters that are on the right-hand side of + the WhiteSpace or LineTerminator productions. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +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/; +const re_u = /\s/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-positive-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-positive-cases.js new file mode 100644 index 00000000000..3a5316b6f0a --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-positive-cases.js @@ -0,0 +1,57 @@ +// 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 that all whitespace characters are matched by \s. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: s evaluates as follows: + Return the set of characters containing the characters that are on the right-hand side of + the WhiteSpace or LineTerminator productions. +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [ + 0x000020, + 0x0000A0, + 0x001680, + 0x00202F, + 0x00205F, + 0x003000, + 0x00FEFF, + ], + ranges: [ + [0x000009, 0x00000D], + [0x002000, 0x00200A], + [0x002028, 0x002029], + ], +}); + +const re = /^\s+$/; +const re_u = /^\s+$/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js deleted file mode 100644 index 9bc78b3408b..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js +++ /dev/null @@ -1,66 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js deleted file mode 100644 index 6ce6c2c781c..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js +++ /dev/null @@ -1,66 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js deleted file mode 100644 index a80b5c7336d..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js +++ /dev/null @@ -1,66 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js deleted file mode 100644 index 879c9ae3403..00000000000 --- a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js +++ /dev/null @@ -1,66 +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/bocoup/test262-regexp-generator - for any changes. - - CharacterClassEscape[U] :: - d - D - s - S - w - W - - 21.2.2.12 CharacterClassEscape - - The production CharacterClassEscape :: d evaluates as follows: - Return the ten-element set of characters containing the characters 0 through 9 inclusive. - The production CharacterClassEscape :: D evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: d. - The production CharacterClassEscape :: s evaluates as follows: - Return the set of characters containing the characters that are on the right-hand side of - the WhiteSpace or LineTerminator productions. - The production CharacterClassEscape :: S evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: s. - The production CharacterClassEscape :: w evaluates as follows: - Return the set of all characters returned by WordCharacters(). - The production CharacterClassEscape :: W evaluates as follows: - Return the set of all characters not included in the set returned by CharacterClassEscape :: w. -features: [String.fromCodePoint] -includes: [regExpUtils.js] ----*/ - -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(',') -); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-negative-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-negative-cases.js new file mode 100644 index 00000000000..feb79f7f535 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-negative-cases.js @@ -0,0 +1,51 @@ +// 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 that none of the non-word characters are matched by \w. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: w evaluates as follows: + Return the set of all characters returned by WordCharacters(). +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [0x000060], + ranges: [ + [0x00DC00, 0x00DFFF], + [0x000000, 0x00002F], + [0x00003A, 0x000040], + [0x00005B, 0x00005E], + [0x00007B, 0x00DBFF], + [0x00E000, 0x10FFFF], + ], +}); + +const re = /\w/; +const re_u = /\w/u; + +const regexes = [re, re_u]; + +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(',') +); diff --git a/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-positive-cases.js b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-positive-cases.js new file mode 100644 index 00000000000..1faa37eafc7 --- /dev/null +++ b/test/built-ins/RegExp/CharacterClassEscapes/character-class-word-positive-cases.js @@ -0,0 +1,48 @@ +// 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 that all word characters are matched by \w. +info: | + 21.2.2.12 CharacterClassEscape + + The production CharacterClassEscape :: w evaluates as follows: + Return the set of all characters returned by WordCharacters(). +features: [String.fromCodePoint] +includes: [regExpUtils.js] +---*/ + +const str = buildString({ + loneCodePoints: [0x00005F], + ranges: [ + [0x000030, 0x000039], + [0x000041, 0x00005A], + [0x000061, 0x00007A], + ], +}); + +const re = /^\w+$/; +const re_u = /^\w+$/u; + +const regexes = [re, re_u]; + +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(',') +);