summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/character-class-escape-non-whitespace.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/RegExp/character-class-escape-non-whitespace.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/character-class-escape-non-whitespace.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/character-class-escape-non-whitespace.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/character-class-escape-non-whitespace.js b/js/src/tests/test262/built-ins/RegExp/character-class-escape-non-whitespace.js
new file mode 100644
index 0000000000..0db2ab6ae3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/character-class-escape-non-whitespace.js
@@ -0,0 +1,57 @@
+// Copyright 2018 Leonardo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-characterclassescape
+description: Detect non WhiteSpace using \S+
+info: |
+ The production CharacterClassEscape :: S evaluates by returning
+ the set of all characters not included in the set returned by
+ CharacterClassEscape :: s
+---*/
+
+var j;
+var i;
+var str;
+var res;
+
+var whitespaceChars = [
+ 0x0009,
+ 0x000A,
+ 0x000B,
+ 0x000C,
+ 0x000D,
+ 0x0020,
+ 0x00A0,
+ 0x1680,
+ 0x2000,
+ 0x2001,
+ 0x2002,
+ 0x2003,
+ 0x2004,
+ 0x2005,
+ 0x2006,
+ 0x2007,
+ 0x2008,
+ 0x2009,
+ 0x200A,
+ 0x2028,
+ 0x2029,
+ 0x202F,
+ 0x205F,
+ 0x3000,
+];
+
+for (j = 0x0000; j < 0x10000; j++) {
+ if (j === 0x180E) { continue; } // Skip 0x180E, current test in a separate file
+ if (j === 0xFEFF) { continue; } // Ignore BOM
+ str = String.fromCharCode(j);
+ res = str.replace(/\S+/g, "test262");
+ if (whitespaceChars.indexOf(j) >= 0) {
+ assert.sameValue(res, str, "WhiteSpace character, charCode: " + j);
+ } else {
+ assert.sameValue(res, "test262", "Non WhiteSpace character, charCode: " + j);
+ }
+}
+
+reportCompare(0, 0);