diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /js/src/tests/non262/RegExp/character-class-escape-s.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/RegExp/character-class-escape-s.js')
-rw-r--r-- | js/src/tests/non262/RegExp/character-class-escape-s.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/js/src/tests/non262/RegExp/character-class-escape-s.js b/js/src/tests/non262/RegExp/character-class-escape-s.js new file mode 100644 index 0000000000..88514c4dda --- /dev/null +++ b/js/src/tests/non262/RegExp/character-class-escape-s.js @@ -0,0 +1,54 @@ +/* Generated by make_unicode.py DO NOT MODIFY */ +/* Unicode version: 15.0.0 */ + +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ +var onlySpace = String.fromCodePoint( + 0x0009 /* <control> (CHARACTER TABULATION) */, + 0x000A /* <control> (LINE FEED (LF)) */, + 0x000B /* <control> (LINE TABULATION) */, + 0x000C /* <control> (FORM FEED (FF)) */, + 0x000D /* <control> (CARRIAGE RETURN (CR)) */, + 0x0020 /* SPACE */, + 0x00A0 /* NO-BREAK SPACE (NON-BREAKING SPACE) */, + 0x1680 /* OGHAM SPACE MARK */, + 0x2000 /* EN QUAD */, + 0x2001 /* EM QUAD */, + 0x2002 /* EN SPACE */, + 0x2003 /* EM SPACE */, + 0x2004 /* THREE-PER-EM SPACE */, + 0x2005 /* FOUR-PER-EM SPACE */, + 0x2006 /* SIX-PER-EM SPACE */, + 0x2007 /* FIGURE SPACE */, + 0x2008 /* PUNCTUATION SPACE */, + 0x2009 /* THIN SPACE */, + 0x200A /* HAIR SPACE */, + 0x2028 /* LINE SEPARATOR */, + 0x2029 /* PARAGRAPH SEPARATOR */, + 0x202F /* NARROW NO-BREAK SPACE */, + 0x205F /* MEDIUM MATHEMATICAL SPACE */, + 0x3000 /* IDEOGRAPHIC SPACE */, + 0xFEFF /* ZERO WIDTH NO-BREAK SPACE (BYTE ORDER MARK) */ +); + +assertEq(/^\s+$/.exec(onlySpace) !== null, true); +assertEq(/^[\s]+$/.exec(onlySpace) !== null, true); +assertEq(/^[^\s]+$/.exec(onlySpace) === null, true); + +assertEq(/^\S+$/.exec(onlySpace) === null, true); +assertEq(/^[\S]+$/.exec(onlySpace) === null, true); +assertEq(/^[^\S]+$/.exec(onlySpace) !== null, true); + +// Also test with Unicode RegExps. +assertEq(/^\s+$/u.exec(onlySpace) !== null, true); +assertEq(/^[\s]+$/u.exec(onlySpace) !== null, true); +assertEq(/^[^\s]+$/u.exec(onlySpace) === null, true); + +assertEq(/^\S+$/u.exec(onlySpace) === null, true); +assertEq(/^[\S]+$/u.exec(onlySpace) === null, true); +assertEq(/^[^\S]+$/u.exec(onlySpace) !== null, true); + +if (typeof reportCompare === "function") + reportCompare(true, true); |