diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes')
26 files changed, 1764 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/browser.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/browser.js diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js new file mode 100644 index 0000000000..20d13f9283 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-flags-u.js @@ -0,0 +1,66 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js new file mode 100644 index 0000000000..54cb356792 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier-flags-u.js @@ -0,0 +1,66 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js new file mode 100644 index 0000000000..aba4e33ca9 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape-plus-quantifier.js @@ -0,0 +1,66 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js new file mode 100644 index 0000000000..e541572ba5 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-digit-class-escape.js @@ -0,0 +1,66 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js new file mode 100644 index 0000000000..8ab26f2945 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-flags-u.js @@ -0,0 +1,67 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js new file mode 100644 index 0000000000..411d71f4bf --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u.js @@ -0,0 +1,67 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js new file mode 100644 index 0000000000..f1a9cd7cc4 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier.js @@ -0,0 +1,67 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js new file mode 100644 index 0000000000..0c1e438333 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape.js @@ -0,0 +1,67 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js new file mode 100644 index 0000000000..0a52b4f6a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-flags-u.js @@ -0,0 +1,78 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js new file mode 100644 index 0000000000..962888f885 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u.js @@ -0,0 +1,78 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js new file mode 100644 index 0000000000..af82575ec4 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier.js @@ -0,0 +1,78 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js new file mode 100644 index 0000000000..785b398eb6 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape.js @@ -0,0 +1,78 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js new file mode 100644 index 0000000000..93f822b3db --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-flags-u.js @@ -0,0 +1,71 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js new file mode 100644 index 0000000000..724df67ea3 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u.js @@ -0,0 +1,71 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js new file mode 100644 index 0000000000..2e69ad39ac --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier.js @@ -0,0 +1,71 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js new file mode 100644 index 0000000000..a0d191b327 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape.js @@ -0,0 +1,71 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js new file mode 100644 index 0000000000..b5fee5f056 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-flags-u.js @@ -0,0 +1,76 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js new file mode 100644 index 0000000000..1ec1485039 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier-flags-u.js @@ -0,0 +1,76 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js new file mode 100644 index 0000000000..c83bb60dd4 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape-plus-quantifier.js @@ -0,0 +1,76 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js new file mode 100644 index 0000000000..b63c03686c --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-whitespace-class-escape.js @@ -0,0 +1,76 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js new file mode 100644 index 0000000000..85f990bdd3 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-flags-u.js @@ -0,0 +1,68 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js new file mode 100644 index 0000000000..27f667229a --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier-flags-u.js @@ -0,0 +1,68 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js new file mode 100644 index 0000000000..092e9e6ea7 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape-plus-quantifier.js @@ -0,0 +1,68 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js new file mode 100644 index 0000000000..35bea6ea4b --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/character-class-word-class-escape.js @@ -0,0 +1,68 @@ +// 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(',') +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/shell.js b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/shell.js new file mode 100644 index 0000000000..3c80817b09 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/CharacterClassEscapes/shell.js @@ -0,0 +1,60 @@ +// GENERATED, DO NOT EDIT +// file: regExpUtils.js +// Copyright (C) 2017 Mathias Bynens. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + Collection of functions used to assert the correctness of RegExp objects. +defines: [buildString, testPropertyEscapes, matchValidator] +---*/ + +function buildString({ loneCodePoints, ranges }) { + const CHUNK_SIZE = 10000; + let result = Reflect.apply(String.fromCodePoint, null, loneCodePoints); + for (let i = 0; i < ranges.length; i++) { + const range = ranges[i]; + const start = range[0]; + const end = range[1]; + const codePoints = []; + for (let length = 0, codePoint = start; codePoint <= end; codePoint++) { + codePoints[length++] = codePoint; + if (length === CHUNK_SIZE) { + result += Reflect.apply(String.fromCodePoint, null, codePoints); + codePoints.length = length = 0; + } + } + result += Reflect.apply(String.fromCodePoint, null, codePoints); + } + return result; +} + +function testPropertyEscapes(regex, string, expression) { + if (!regex.test(string)) { + for (const symbol of string) { + const hex = symbol + .codePointAt(0) + .toString(16) + .toUpperCase() + .padStart(6, "0"); + assert( + regex.test(symbol), + `\`${ expression }\` should match U+${ hex } (\`${ symbol }\`)` + ); + } + } +} + +// Returns a function that will validate RegExp match result +// +// Example: +// +// var validate = matchValidator(['b'], 1, 'abc'); +// validate(/b/.exec('abc')); +// +function matchValidator(expectedEntries, expectedIndex, expectedInput) { + return function(match) { + assert.compareArray(match, expectedEntries, 'Match entries'); + assert.sameValue(match.index, expectedIndex, 'Match index'); + assert.sameValue(match.input, expectedInput, 'Match input'); + } +} |