summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/String/unicode-braced.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/ecma_6/String/unicode-braced.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma_6/String/unicode-braced.js')
-rw-r--r--js/src/tests/ecma_6/String/unicode-braced.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/String/unicode-braced.js b/js/src/tests/ecma_6/String/unicode-braced.js
new file mode 100644
index 000000000..62d96b844
--- /dev/null
+++ b/js/src/tests/ecma_6/String/unicode-braced.js
@@ -0,0 +1,64 @@
+var BUGNUMBER = 320500;
+var summary = 'Add \\u{xxxxxx} string literals';
+
+print(BUGNUMBER + ": " + summary);
+
+assertEq("\u{0}", String.fromCodePoint(0x0));
+assertEq("\u{1}", String.fromCodePoint(0x1));
+assertEq("\u{10}", String.fromCodePoint(0x10));
+assertEq("\u{100}", String.fromCodePoint(0x100));
+assertEq("\u{1000}", String.fromCodePoint(0x1000));
+assertEq("\u{D7FF}", String.fromCodePoint(0xD7FF));
+assertEq("\u{D800}", String.fromCodePoint(0xD800));
+assertEq("\u{DBFF}", String.fromCodePoint(0xDBFF));
+assertEq("\u{DC00}", String.fromCodePoint(0xDC00));
+assertEq("\u{DFFF}", String.fromCodePoint(0xDFFF));
+assertEq("\u{E000}", String.fromCodePoint(0xE000));
+assertEq("\u{10000}", String.fromCodePoint(0x10000));
+assertEq("\u{100000}", String.fromCodePoint(0x100000));
+assertEq("\u{10FFFF}", String.fromCodePoint(0x10FFFF));
+assertEq("\u{10ffff}", String.fromCodePoint(0x10FFFF));
+
+assertEq("A\u{1}\u{10}B\u{100}\u{1000}\u{10000}C\u{100000}",
+ "A" +
+ String.fromCodePoint(0x1) +
+ String.fromCodePoint(0x10) +
+ "B" +
+ String.fromCodePoint(0x100) +
+ String.fromCodePoint(0x1000) +
+ String.fromCodePoint(0x10000) +
+ "C" +
+ String.fromCodePoint(0x100000));
+
+assertEq('\u{10ffff}', String.fromCodePoint(0x10FFFF));
+assertEq(`\u{10ffff}`, String.fromCodePoint(0x10FFFF));
+assertEq(`\u{10ffff}${""}`, String.fromCodePoint(0x10FFFF));
+assertEq(`${""}\u{10ffff}`, String.fromCodePoint(0x10FFFF));
+assertEq(`${""}\u{10ffff}${""}`, String.fromCodePoint(0x10FFFF));
+
+assertEq("\u{00}", String.fromCodePoint(0x0));
+assertEq("\u{00000000000000000}", String.fromCodePoint(0x0));
+assertEq("\u{00000000000001000}", String.fromCodePoint(0x1000));
+
+assertEq(eval(`"\\u{${"0".repeat(Math.pow(2, 24)) + "1234"}}"`), String.fromCodePoint(0x1234));
+
+assertEq("\U{0}", "U{0}");
+
+assertThrowsInstanceOf(() => eval(`"\\u{-1}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{0.0}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{G}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{{"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{110000}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{00110000}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{100000000000000000000000000000}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{ FFFF}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{FFFF }"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{FF FF}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{F F F F}"`), SyntaxError);
+assertThrowsInstanceOf(() => eval(`"\\u{100000001}"`), SyntaxError);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);