2018-07-09 18:30:33 +02:00
|
|
|
// 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: >
|
2018-11-07 00:24:07 +01:00
|
|
|
Compare range for non-whitespace class escape \S+ with flags g
|
2018-07-09 18:30:33 +02:00
|
|
|
info: |
|
2018-11-07 00:24:07 +01:00
|
|
|
This is a generated test. Please check out
|
|
|
|
https://github.com/bocoup/test262-regexp-generator
|
2018-07-09 18:30:33 +02:00
|
|
|
for any changes.
|
|
|
|
|
|
|
|
CharacterClassEscape[U] ::
|
|
|
|
d
|
|
|
|
D
|
|
|
|
s
|
|
|
|
S
|
|
|
|
w
|
|
|
|
W
|
|
|
|
|
|
|
|
21.2.2.12 CharacterClassEscape
|
2018-11-07 00:24:07 +01:00
|
|
|
|
2018-07-09 18:30:33 +02:00
|
|
|
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]
|
2018-08-17 16:48:42 +02:00
|
|
|
includes: [regExpUtils.js]
|
2018-07-09 18:30:33 +02:00
|
|
|
---*/
|
|
|
|
|
2018-11-07 00:24:07 +01:00
|
|
|
const str = buildString({ loneCodePoints: [], ranges: [[0, 0xFFFF]] });
|
2018-07-09 18:30:33 +02:00
|
|
|
|
|
|
|
const re = /\S+/g;
|
|
|
|
const matchingRange = /[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uFEFE\uFF00-\uFFFF]+/g;
|
|
|
|
|
|
|
|
const errors = [];
|
|
|
|
|
|
|
|
function matching(str) {
|
|
|
|
return str.replace(re, '') === str.replace(matchingRange, '');
|
|
|
|
}
|
|
|
|
|
2018-08-17 16:48:42 +02:00
|
|
|
if (!matching(str)) {
|
|
|
|
// Error, let's find out where
|
|
|
|
for (const char of str) {
|
|
|
|
if (!matching(char)) {
|
|
|
|
errors.push('0x' + char.codePointAt(0).toString(16));
|
2018-07-09 18:30:33 +02:00
|
|
|
}
|
|
|
|
}
|
2018-08-17 16:48:42 +02:00
|
|
|
}
|
2018-07-09 18:30:33 +02:00
|
|
|
|
|
|
|
assert.sameValue(
|
|
|
|
errors.length,
|
|
|
|
0,
|
|
|
|
'Expected matching code points, but received: ' + errors.join(',')
|
|
|
|
);
|