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/language/literals/string | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.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/language/literals/string')
72 files changed, 2379 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T1.js new file mode 100644 index 0000000000..cf7d8b2b70 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T1.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"DoubleStringCharacters_opt\"" +es5id: 7.8.4_A1.1_T1 +description: > + DoubleStringCharacter :: SourceCharacter but not double-quote " or + LineTerminator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +""" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T2.js new file mode 100644 index 0000000000..1bacc121ef --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A1.1_T2.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"DoubleStringCharacters_opt\"" +es5id: 7.8.4_A1.1_T2 +description: > + DoubleStringCharacter :: SourceCharacter but not double-quote " or + LineTerminator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +" +" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T1.js new file mode 100644 index 0000000000..5b39940322 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T1.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: 'SingleStringCharacters_opt'" +es5id: 7.8.4_A1.2_T1 +description: > + SingleStringCharacter :: SourceCharacter but not single-quote ' or + LineTerminator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +''' diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T2.js new file mode 100644 index 0000000000..408260e9cd --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A1.2_T2.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: 'SingleStringCharacters_opt'" +es5id: 7.8.4_A1.2_T2 +description: > + SingleStringCharacter :: SourceCharacter but not single-quote ' or + LineTerminator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +' +' diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T1.js new file mode 100644 index 0000000000..5c1657a7b9 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of ENGLISH ALPHABET +es5id: 7.8.4_A2.1_T1 +description: Check ENGLISH CAPITAL ALPHABET +---*/ + +//CHECK#A-Z +var unicode = ["\u0041", "\u0042", "\u0043", "\u0044", "\u0045", "\u0046", "\u0047", "\u0048", "\u0049", "\u004A", "\u004B", "\u004C", "\u004D", "\u004E", "\u004F", "\u0050", "\u0051", "\u0052", "\u0053", "\u0054", "\u0055", "\u0056", "\u0057", "\u0058", "\u0059", "\u005A"]; +var character = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +for (var index = 0; index <= 25; index++) { + if (unicode[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T2.js new file mode 100644 index 0000000000..433d0c7ed7 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of ENGLISH ALPHABET +es5id: 7.8.4_A2.1_T2 +description: Check ENGLISH SMALL ALPHABET +---*/ + +//CHECK#a-z +var hex = ["\u0061", "\u0062", "\u0063", "\u0064", "\u0065", "\u0066", "\u0067", "\u0068", "\u0069", "\u006A", "\u006B", "\u006C", "\u006D", "\u006E", "\u006F", "\u0070", "\u0071", "\u0072", "\u0073", "\u0074", "\u0075", "\u0076", "\u0077", "\u0078", "\u0079", "\u007A"]; +var character = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var index = 0; index <= 25; index++) { + if (hex[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T1.js new file mode 100644 index 0000000000..ce31a8e2ad --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of RUSSIAN ALPHABET +es5id: 7.8.4_A2.2_T1 +description: Check RUSSIAN CAPITAL ALPHABET +---*/ + +//CHECK#А-Я +var unicode = ["\u0410", "\u0411", "\u0412", "\u0413", "\u0414", "\u0415", "\u0416", "\u0417", "\u0418", "\u0419", "\u041A", "\u041B", "\u041C", "\u041D", "\u041E", "\u041F", "\u0420", "\u0421", "\u0422", "\u0423", "\u0424", "\u0425", "\u0426", "\u0427", "\u0428", "\u0429", "\u042A", "\u042B", "\u042C", "\u042D", "\u042E", "\u042F", "\u0401"]; +var character = ["А", "Б", "В", "Г", "Д", "Е", "Ж", "З", "И", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ъ", "Ы", "Ь", "Э", "Ю", "Я", "Ё"]; +for (var index = 0; index <= 32; index++) { + if (unicode[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T2.js new file mode 100644 index 0000000000..1a48d28a04 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.2_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of RUSSIAN ALPHABET +es5id: 7.8.4_A2.2_T2 +description: Check RUSSIAN SMALL ALPHABET +---*/ + +//CHECK#а-я +var unicode = ["\u0430", "\u0431", "\u0432", "\u0433", "\u0434", "\u0435", "\u0436", "\u0437", "\u0438", "\u0439", "\u043A", "\u043B", "\u043C", "\u043D", "\u043E", "\u043F", "\u0440", "\u0441", "\u0442", "\u0443", "\u0444", "\u0445", "\u0446", "\u0447", "\u0448", "\u0449", "\u044A", "\u044B", "\u044C", "\u044D", "\u044E", "\u044F", "\u0451"]; +var character = ["а", "б", "в", "г", "д", "е", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", "ь", "э", "ю", "я", "ё"]; +for (var index = 0; index <= 32; index++) { + if (unicode[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A2.3_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A2.3_T1.js new file mode 100644 index 0000000000..a747e583a5 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A2.3_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Correct interpretation of DIGITS +es5id: 7.8.4_A2.3_T1 +description: Check DIGITS +---*/ + +//CHECK#0-9 +var unicode = ["\u0030", "\u0031", "\u0032", "\u0033", "\u0034", "\u0035", "\u0036", "\u0037", "\u0038", "\u0039"]; +var character = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; +for (var index = 0; index <= 9; index++) { + if (unicode[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T1.js new file mode 100644 index 0000000000..5a579af9f2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T1.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"\\\" or '\\' is not correct" +es5id: 7.8.4_A3.1_T1 +description: Checking if execution of "\" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T2.js new file mode 100644 index 0000000000..8db6c37088 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A3.1_T2.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"\\\" or '\\' is not correct" +es5id: 7.8.4_A3.1_T2 +description: Checking if execution of "'\'" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +'\' diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T1.js new file mode 100644 index 0000000000..e85ed3e55a --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T1.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"\\\\\\\" or '\\\\\\' is not correct" +es5id: 7.8.4_A3.2_T1 +description: Checking if execution of "\\\" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\\\" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T2.js new file mode 100644 index 0000000000..a3d4bb194e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A3.2_T2.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "StringLiteral :: \"\\\\\\\" or '\\\\\\' is not correct" +es5id: 7.8.4_A3.2_T2 +description: Checking if execution of '\\\' fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +'\\\' diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T1.js new file mode 100644 index 0000000000..21d05184ed --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: SingleEscapeSequence" +es5id: 7.8.4_A4.1_T1 +description: "SingleEscapeSequence :: one of b f n r t v" +---*/ + +//CHECK#1 +if (String.fromCharCode(0x0008) !== "\b") { + $ERROR('#1: String.fromCharCode(0x0008) === "\\b"'); +} + +//CHECK#2 +if (String.fromCharCode(0x0009) !== "\t") { + $ERROR('#2: String.fromCharCode(0x0009) === "\\t"'); +} + +//CHECK#3 +if (String.fromCharCode(0x000A) !== "\n") { + $ERROR('#3: String.fromCharCode(0x000A) === "\\n"'); +} + +//CHECK#4 +if (String.fromCharCode(0x000B) !== "\v") { + $ERROR('#4: String.fromCharCode(0x000B) === "\\v"'); +} + +//CHECK#5 +if (String.fromCharCode(0x000C) !== "\f") { + $ERROR('#5: String.fromCharCode(0x000C) === "\\f"'); +} + +//CHECK#6 +if (String.fromCharCode(0x000D) !== "\r") { + $ERROR('#6: String.fromCharCode(0x000D) === "\\r"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T2.js new file mode 100644 index 0000000000..3024fc1897 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.1_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: SingleEscapeSequence" +es5id: 7.8.4_A4.1_T2 +description: "SingleEscapeSequence :: one of ' \" \\" +---*/ + +//CHECK#1 +if (String.fromCharCode(0x0027) !== "\'") { + $ERROR('#1: String.fromCharCode(0x0027) === "\\\'"'); +} + +//CHECK#2 +if (String.fromCharCode(0x0022) !== '\"') { + $ERROR('#2: String.fromCharCode(0x0027) === \'\\\"\''); +} + +//CHECK#3 +if (String.fromCharCode(0x005C) !== "\\") { + $ERROR('#3: String.fromCharCode(0x005C) === "\\\"'); +} + +//CHECK#4 +if ("\'" !== "'") { + $ERROR('#4: "\'" === "\\\'"'); +} + +//CHECK#5 +if ('\"' !== '"') { + $ERROR('#5: \'\"\' === \'\\\"\''); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T1.js new file mode 100644 index 0000000000..9f63af210b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T1 +description: "NonEscapeSequence :: ENGLISH CAPITAL ALPHABET" +---*/ + +//CHECK#A-Z +var CharacterCode = [0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A]; +var NonEscapeCharacter = ["\A", "\B", "\C", "\D", "\E", "\F", "\G", "\H", "\I", "\J", "\K", "\L", "\M", "\N", "\O", "\P", "\Q", "\R", "\S", "\T", "\U", "\V", "\W", "\X", "\Y", "\Z"]; +for (var index = 0; index <= 25; index++) { + if (String.fromCharCode(CharacterCode[index]) !== NonEscapeCharacter[index]) { + $ERROR('#' + NonEscapeCharacter[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T2.js new file mode 100644 index 0000000000..09595cbc2e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T2.js @@ -0,0 +1,115 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T2 +description: "NonEscapeSequence :: ENGLISH CAPITAL ALPHABET" +---*/ + +//CHECK#A-Z +if ("A" !== "\A") { + $ERROR('#A'); +} + +if ("B" !== "\B") { + $ERROR('#B'); +} + +if ("C" !== "\C") { + $ERROR('#C'); +} + +if ("D" !== "\D") { + $ERROR('#D'); +} + +if ("E" !== "\E") { + $ERROR('#E'); +} + +if ("F" !== "\F") { + $ERROR('#F'); +} + +if ("G" !== "\G") { + $ERROR('#G'); +} + +if ("H" !== "\H") { + $ERROR('#H'); +} + +if ("I" !== "\I") { + $ERROR('#I'); +} + +if ("J" !== "\J") { + $ERROR('#J'); +} + +if ("K" !== "\K") { + $ERROR('#K'); +} + +if ("L" !== "\L") { + $ERROR('#L'); +} + +if ("M" !== "\M") { + $ERROR('#M'); +} + +if ("N" !== "\N") { + $ERROR('#N'); +} + +if ("O" !== "\O") { + $ERROR('#O'); +} + +if ("P" !== "\P") { + $ERROR('#P'); +} + +if ("Q" !== "\Q") { + $ERROR('#Q'); +} + +if ("R" !== "\R") { + $ERROR('#R'); +} + +if ("S" !== "\S") { + $ERROR('#S'); +} + +if ("T" !== "\T") { + $ERROR('#T'); +} + +if ("U" !== "\U") { + $ERROR('#U'); +} + +if ("V" !== "\V") { + $ERROR('#V'); +} + +if ("W" !== "\W") { + $ERROR('#W'); +} + +if ("X" !== "\X") { + $ERROR('#X'); +} + +if ("Y" !== "\Y") { + $ERROR('#Y'); +} + +if ("Z" !== "\Z") { + $ERROR('#Z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T3.js new file mode 100644 index 0000000000..48f842df0f --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T3 +description: "NonEscapeSequence :: ENGLISH SMALL ALPHABET" +---*/ + +//CHECK#a-z without b, f, n, r, t, v, x, u +var CharacterCode = [0x0061, 0x0063, 0x0064, 0x0065, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006F, 0x0070, 0x0071, 0x0073, 0x0077, 0x0079, 0x007A]; +var NonEscapeCharacter = ["\a", "\c", "\d", "\e", "\g", "\h", "\i", "\j", "\k", "\l", "\m", "\o", "\p", "\q", "\s", "\w", "\y", "\z"]; +for (var index = 0; index <= 17; index++) { + if (String.fromCharCode(CharacterCode[index]) !== NonEscapeCharacter[index]) { + $ERROR('#' + NonEscapeCharacter[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T4.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T4.js new file mode 100644 index 0000000000..84864e61d4 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T4.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T4 +description: "NonEscapeSequence :: ENGLISH SMALL ALPHABET" +---*/ + +//CHECK#a-z without b, f, n, r, t, v, x, u + +if ("a" !== "\a") { + $ERROR('#a'); +} + +if ("c" !== "\c") { + $ERROR('#c'); +} + +if ("d" !== "\d") { + $ERROR('#d'); +} + +if ("e" !== "\e") { + $ERROR('#e'); +} + +if ("g" !== "\g") { + $ERROR('#g'); +} + +if ("h" !== "\h") { + $ERROR('#h'); +} + +if ("i" !== "\i") { + $ERROR('#i'); +} + +if ("j" !== "\j") { + $ERROR('#j'); +} + +if ("k" !== "\k") { + $ERROR('#k'); +} + +if ("l" !== "\l") { + $ERROR('#l'); +} + +if ("m" !== "\m") { + $ERROR('#m'); +} + + +if ("o" !== "\o") { + $ERROR('#o'); +} + +if ("p" !== "\p") { + $ERROR('#p'); +} + +if ("q" !== "\q") { + $ERROR('#q'); +} + +if ("s" !== "\s") { + $ERROR('#s'); +} + +if ("w" !== "\w") { + $ERROR('#w'); +} + +if ("y" !== "\y") { + $ERROR('#y'); +} + +if ("z" !== "\z") { + $ERROR('#z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T5.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T5.js new file mode 100644 index 0000000000..bb6c4dffd6 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T5.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T5 +description: "NonEscapeSequence :: RUSSIAN CAPITAL ALPHABET" +---*/ + +//CHECK#А-Я +var CharacterCode = [0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0401]; +var NonEscapeCharacter = ["\А", "\Б", "\В", "\Г", "\Д", "\Е", "\Ж", "\З", "\И", "\Й", "\К", "\Л", "\М", "\Н", "\О", "\П", "\Р", "\С", "\Т", "\У", "\Ф", "\Х", "\Ц", "\Ч", "\Ш", "\Щ", "\Ъ", "\Ы", "\Ь", "\Э", "\Ю", "\Я", "\Ё"]; +for (var index = 0; index <= 32; index++) { + if (String.fromCharCode(CharacterCode[index]) !== NonEscapeCharacter[index]) { + $ERROR('#' + NonEscapeCharacter[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T6.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T6.js new file mode 100644 index 0000000000..f27218a501 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T6.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T6 +description: "NonEscapeSequence :: RUSSIAN CAPITAL ALPHABET" +---*/ + +//CHECK#А-Я + +if ("А" !== "\А") { + $ERROR('#А'); +} + +if ("Б" !== "\Б") { + $ERROR('#Б'); +} + +if ("В" !== "\В") { + $ERROR('#В'); +} + +if ("Г" !== "\Г") { + $ERROR('#Г'); +} + +if ("Д" !== "\Д") { + $ERROR('#Д'); +} + +if ("Е" !== "\Е") { + $ERROR('#Е'); +} + +if ("Ж" !== "\Ж") { + $ERROR('#Ж'); +} + +if ("З" !== "\З") { + $ERROR('#З'); +} + +if ("И" !== "\И") { + $ERROR('#И'); +} + +if ("Й" !== "\Й") { + $ERROR('#Й'); +} + +if ("К" !== "\К") { + $ERROR('#К'); +} + +if ("Л" !== "\Л") { + $ERROR('#Л'); +} + +if ("М" !== "\М") { + $ERROR('#М'); +} + +if ("Н" !== "\Н") { + $ERROR('#Н'); +} + +if ("О" !== "\О") { + $ERROR('#О'); +} + +if ("П" !== "\П") { + $ERROR('#П'); +} + +if ("Р" !== "\Р") { + $ERROR('#Р'); +} + +if ("С" !== "\С") { + $ERROR('#С'); +} + +if ("Т" !== "\Т") { + $ERROR('#Т'); +} + +if ("У" !== "\У") { + $ERROR('#У'); +} + +if ("Ф" !== "\Ф") { + $ERROR('#Ф'); +} + +if ("Х" !== "\Х") { + $ERROR('#Х'); +} + +if ("Ц" !== "\Ц") { + $ERROR('#Ц'); +} + +if ("Ч" !== "\Ч") { + $ERROR('#Ч'); +} + +if ("Ш" !== "\Ш") { + $ERROR('#Ш'); +} + +if ("Щ" !== "\Щ") { + $ERROR('#Щ'); +} + +if ("Ъ" !== "\Ъ") { + $ERROR('#Ъ'); +} + +if ("Ы" !== "\Ы") { + $ERROR('#Ы'); +} + +if ("Ь" !== "\Ь") { + $ERROR('#Ь'); +} + +if ("Э" !== "\Э") { + $ERROR('#Э'); +} + +if ("Ю" !== "\Ю") { + $ERROR('#Ю'); +} + +if ("Я" !== "\Я") { + $ERROR('#Я'); +} + +if ("Ё" !== "\Ё") { + $ERROR('#Ё'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T7.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T7.js new file mode 100644 index 0000000000..12751a3a84 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T7 +description: "NonEscapeSequence :: RUSSIAN SMALL ALPHABET" +---*/ + +//CHECK#а-я +var CharacterCode = [0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x0451]; +var NonEscapeCharacter = ["\а", "\б", "\в", "\г", "\д", "\е", "\ж", "\з", "\и", "\й", "\к", "\л", "\м", "\н", "\о", "\п", "\р", "\с", "\т", "\у", "\ф", "\х", "\ц", "\ч", "\ш", "\щ", "\ъ", "\ы", "\ь", "\э", "\ю", "\я", "\ё"]; +for (var index = 0; index <= 32; index++) { + if (String.fromCharCode(CharacterCode[index]) !== NonEscapeCharacter[index]) { + $ERROR('#' + NonEscapeCharacter[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T8.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T8.js new file mode 100644 index 0000000000..3110f67f6f --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.2_T8.js @@ -0,0 +1,144 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CharacterEscapeSequnce :: NonEscapeSequence" +es5id: 7.8.4_A4.2_T8 +description: "NonEscapeSequence :: RUSSIAN SMALL ALPHABET" +---*/ + +//CHECK#а-я + +if ("а" !== "\а") { + $ERROR('#а'); +} + +if ("б" !== "\б") { + $ERROR('#б'); +} + +if ("в" !== "\в") { + $ERROR('#в'); +} + +if ("г" !== "\г") { + $ERROR('#г'); +} + +if ("д" !== "\д") { + $ERROR('#д'); +} + +if ("е" !== "\е") { + $ERROR('#е'); +} + +if ("ж" !== "\ж") { + $ERROR('#ж'); +} + +if ("з" !== "\з") { + $ERROR('#з'); +} + +if ("и" !== "\и") { + $ERROR('#и'); +} + +if ("й" !== "\й") { + $ERROR('#й'); +} + +if ("к" !== "\к") { + $ERROR('#к'); +} + +if ("л" !== "\л") { + $ERROR('#л'); +} + +if ("м" !== "\м") { + $ERROR('#м'); +} + +if ("н" !== "\н") { + $ERROR('#н'); +} + +if ("о" !== "\о") { + $ERROR('#о'); +} + +if ("п" !== "\п") { + $ERROR('#п'); +} + +if ("р" !== "\р") { + $ERROR('#р'); +} + +if ("с" !== "\с") { + $ERROR('#с'); +} + +if ("т" !== "\т") { + $ERROR('#т'); +} + +if ("у" !== "\у") { + $ERROR('#у'); +} + +if ("ф" !== "\ф") { + $ERROR('#ф'); +} + +if ("х" !== "\х") { + $ERROR('#х'); +} + +if ("ц" !== "\ц") { + $ERROR('#ц'); +} + +if ("ч" !== "\ч") { + $ERROR('#ч'); +} + +if ("ш" !== "\ш") { + $ERROR('#ш'); +} + +if ("щ" !== "\щ") { + $ERROR('#щ'); +} + +if ("ъ" !== "\ъ") { + $ERROR('#ъ'); +} + +if ("ы" !== "\ы") { + $ERROR('#ы'); +} + +if ("ь" !== "\ь") { + $ERROR('#ь'); +} + +if ("э" !== "\э") { + $ERROR('#э'); +} + +if ("ю" !== "\ю") { + $ERROR('#ю'); +} + +if ("я" !== "\я") { + $ERROR('#я'); +} + +if ("ё" !== "\ё") { + $ERROR('#ё'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T1-strict.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T1-strict.js new file mode 100644 index 0000000000..e691313b80 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T1-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: NonEscapeSequence is not EscapeCharacter +es5id: 7.8.4_A4.3_T1 +description: "EscapeCharacter :: DecimalDigits :: 1" +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +"\1" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T2-strict.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T2-strict.js new file mode 100644 index 0000000000..53b059e5bd --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T2-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: NonEscapeSequence is not EscapeCharacter +es5id: 7.8.4_A4.3_T2 +description: "EscapeCharacter :: DecimalDigits :: 7" +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +"\7" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T7.js b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T7.js new file mode 100644 index 0000000000..71d3676073 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A4.3_T7.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: NonEscapeSequence is not EscapeCharacter +es5id: 7.8.4_A4.3_T7 +description: "EscapeCharacter :: SingleEscapeCharacter :: one of b f n r t v" +---*/ + +//CHECK#bfnrtv +if ("b" === "\b") { + $ERROR('#b'); +} + +if ("f" === "\f") { + $ERROR('#f'); +} + +if ("n" === "\n") { + $ERROR('#n'); +} + +if ("r" === "\r") { + $ERROR('#r'); +} + +if ("t" === "\t") { + $ERROR('#t'); +} + +if ("v" === "\v") { + $ERROR('#v'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T1.js new file mode 100644 index 0000000000..125d8d52cb --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: 0" +es5id: 7.8.4_A5.1_T1 +description: String.fromCharCode(0x0000) +---*/ + +//CHECK#1 +if (String.fromCharCode(0x0000) !== "\0") { + $ERROR('#1: String.fromCharCode(0x0000) === "\\0"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T2.js new file mode 100644 index 0000000000..49938f8278 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: 0" +es5id: 7.8.4_A5.1_T2 +description: "\"\\u0000\"" +---*/ + +//CHECK#1 +if ("\u0000" !== "\0") { + $ERROR('#1: "\\u0000" === "\\0"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T3.js new file mode 100644 index 0000000000..56bacd2cfc --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A5.1_T3.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: 0" +es5id: 7.8.4_A5.1_T3 +description: "\"\\x00\"" +---*/ + +//CHECK#1 +if ("\x00" !== "\0") { + $ERROR('#1: "\\x00" === "\\0"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T1.js new file mode 100644 index 0000000000..7d117a8007 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T1.js @@ -0,0 +1,90 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: HexEscapeSequence :: x HexDigit HexDigit" +es5id: 7.8.4_A6.1_T1 +description: "HexEscapeSequence :: HexDigit" +---*/ + +//CHECK#0 +if ("\x00" !== String.fromCharCode("0")) { + $ERROR('#0: "\\x00" === String.fromCharCode("0")'); +} + +//CHECK#1 +if ("\x01" !== String.fromCharCode("1")) { + $ERROR('#1: "\\x01" === String.fromCharCode("1")'); +} + +//CHECK#2 +if ("\x02" !== String.fromCharCode("2")) { + $ERROR('#2: "\\x02" === String.fromCharCode("2")'); +} + +//CHECK#3 +if ("\x03" !== String.fromCharCode("3")) { + $ERROR('#3: "\\x03" === String.fromCharCode("3")'); +} + +//CHECK#4 +if ("\x04" !== String.fromCharCode("4")) { + $ERROR('#4: "\\x04" === String.fromCharCode("4")'); +} + +//CHECK#5 +if ("\x05" !== String.fromCharCode("5")) { + $ERROR('#5: "\\x05" === String.fromCharCode("5")'); +} + +//CHECK#6 +if ("\x06" !== String.fromCharCode("6")) { + $ERROR('#6: "\\x06" === String.fromCharCode("6")'); +} + +//CHECK#7 +if ("\x07" !== String.fromCharCode("7")) { + $ERROR('#7: "\\x07" === String.fromCharCode("7")'); +} + +//CHECK#8 +if ("\x08" !== String.fromCharCode("8")) { + $ERROR('#8: "\\x08" === String.fromCharCode("8")'); +} + +//CHECK#9 +if ("\x09" !== String.fromCharCode("9")) { + $ERROR('#9: "\\x09" === String.fromCharCode("9")'); +} + +//CHECK#A +if ("\x0A" !== String.fromCharCode("10")) { + $ERROR('#A: "\\x0A" === String.fromCharCode("10")'); +} + +//CHECK#B +if ("\x0B" !== String.fromCharCode("11")) { + $ERROR('#B: "\\x0B" === String.fromCharCode("11")'); +} + +//CHECK#C +if ("\x0C" !== String.fromCharCode("12")) { + $ERROR('#C: "\\x0C" === String.fromCharCode("12")'); +} + +//CHECK#D +if ("\x0D" !== String.fromCharCode("13")) { + $ERROR('#D: "\\x0D" === String.fromCharCode("13")'); +} + +//CHECK#E +if ("\x0E" !== String.fromCharCode("14")) { + $ERROR('#E: "\\x0E" === String.fromCharCode("14")'); +} + +//CHECK#F +if ("\x0F" !== String.fromCharCode("15")) { + $ERROR('#F: "\\x0F" === String.fromCharCode("15")'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T2.js new file mode 100644 index 0000000000..73b4abfd2a --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: HexEscapeSequence :: x HexDigit HexDigit" +es5id: 7.8.4_A6.1_T2 +description: "HexEscapeSequence :: ENGLISH CAPITAL ALPHABET" +---*/ + +//CHECK#A-Z +var hex = ["\x41", "\x42", "\x43", "\x44", "\x45", "\x46", "\x47", "\x48", "\x49", "\x4A", "\x4B", "\x4C", "\x4D", "\x4E", "\x4F", "\x50", "\x51", "\x52", "\x53", "\x54", "\x55", "\x56", "\x57", "\x58", "\x59", "\x5A"]; +var character = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +for (var index = 0; index <= 25; index++) { + if (hex[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T3.js new file mode 100644 index 0000000000..d82ff5c0ca --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A6.1_T3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "EscapeSequence :: HexEscapeSequence :: x HexDigit HexDigit" +es5id: 7.8.4_A6.1_T3 +description: "HexEscapeSequence :: ENGLISH SMALL ALPHABET" +---*/ + +//CHECK#a-z +var hex = ["\x61", "\x62", "\x63", "\x64", "\x65", "\x66", "\x67", "\x68", "\x69", "\x6A", "\x6B", "\x6C", "\x6D", "\x6E", "\x6F", "\x70", "\x71", "\x72", "\x73", "\x74", "\x75", "\x76", "\x77", "\x78", "\x79", "\x7A"]; +var character = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var index = 0; index <= 25; index++) { + if (hex[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A6.3_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A6.3_T1.js new file mode 100644 index 0000000000..5b5941130e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A6.3_T1.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: \x HexDigit HexDigit SingleStringCharacter +es5id: 7.8.4_A6.3_T1 +description: Check similar to ('\x01F' === String.fromCharCode('1') + 'F') +---*/ + +//CHECK#1 +if ('\x01F' !== String.fromCharCode('1') + 'F') { + $ERROR("#1: '\x01F' === String.fromCharCode('1') + 'F'"); +} + +//CHECK#2 +if ('\x02E' !== String.fromCharCode('2') + 'E') { + $ERROR("#2: '\x02E' === String.fromCharCode('2') + 'E'"); +} + +//CHECK#3 +if ('\x03D' !== String.fromCharCode('3') + 'D') { + $ERROR("#3: '\x03D' === String.fromCharCode('3') + 'D'"); +} + +//CHECK#4 +if ('\x04C' !== String.fromCharCode('4') + 'C') { + $ERROR("#4: '\x04C' === String.fromCharCode('4') + 'C'"); +} + +//CHECK#5 +if ('\x05B' !== String.fromCharCode('5') + 'B') { + $ERROR("#5: '\x05B' === String.fromCharCode('5') + 'B'"); +} + +//CHECK#6 +if ('\x06A' !== String.fromCharCode('6') + 'A') { + $ERROR("#6: '\x06A' === String.fromCharCode('6') + 'A'"); +} + +//CHECK#7 +if ('\x079' !== String.fromCharCode('7') + '9') { + $ERROR("#7: '\x079' === String.fromCharCode('7') + '9'"); +} + +//CHECK#8 +if ('\x088' !== String.fromCharCode('8') + '8') { + $ERROR("#8: '\x088' === String.fromCharCode('8') + '8'"); +} + +//CHECK#9 +if ('\x097' !== String.fromCharCode('9') + '7') { + $ERROR("#9: '\x097' === String.fromCharCode('9') + '7'"); +} + +//CHECK#A +if ('\x0A6' !== String.fromCharCode('10') + '6') { + $ERROR("#A: '\x0A6' === String.fromCharCode('10') + '6'"); +} + +//CHECK#B +if ('\x0B5' !== String.fromCharCode('11') + '5') { + $ERROR("#B: '\x0B5' === String.fromCharCode('11') + '5'"); +} + +//CHECK#C +if ('\x0C4' !== String.fromCharCode('12') + '4') { + $ERROR("#C: '\x0C4' === String.fromCharCode('12') + '4'"); +} + +//CHECK#D +if ('\x0D3' !== String.fromCharCode('13') + '3') { + $ERROR("#D: '\x0D3' === String.fromCharCode('13') + '3'"); +} + +//CHECK#E +if ('\x0E2' !== String.fromCharCode('14') + '2') { + $ERROR("#E: '\x0E2' === String.fromCharCode('14') + '2'"); +} + +//CHECK#F +if ('\x0F1' !== String.fromCharCode('15') + '1') { + $ERROR("#F: '\x0F1' === String.fromCharCode('15') + '1'"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T1.js new file mode 100644 index 0000000000..f467eb891b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T1.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit + HexDigit +es5id: 7.8.4_A7.1_T1 +description: Check similar to ("\u0000" === String.fromCharCode("0")) +---*/ + +//CHECK#0 +if ("\u0000" !== String.fromCharCode("0")) { + $ERROR('#0: "\\u0000" === String.fromCharCode("0")'); +} + +//CHECK#1 +if ("\u0001" !== String.fromCharCode("1")) { + $ERROR('#1: "\\u0001" === String.fromCharCode("1")'); +} + +//CHECK#2 +if ("\u0002" !== String.fromCharCode("2")) { + $ERROR('#2: "\\u0002" === String.fromCharCode("2")'); +} + +//CHECK#3 +if ("\u0003" !== String.fromCharCode("3")) { + $ERROR('#3: "\\u0003" === String.fromCharCode("3")'); +} + +//CHECK#4 +if ("\u0004" !== String.fromCharCode("4")) { + $ERROR('#4: "\\u0004" === String.fromCharCode("4")'); +} + +//CHECK#5 +if ("\u0005" !== String.fromCharCode("5")) { + $ERROR('#5: "\\u0005" === String.fromCharCode("5")'); +} + +//CHECK#6 +if ("\u0006" !== String.fromCharCode("6")) { + $ERROR('#6: "\\u0006" === String.fromCharCode("6")'); +} + +//CHECK#7 +if ("\u0007" !== String.fromCharCode("7")) { + $ERROR('#7: "\\u0007" === String.fromCharCode("7")'); +} + +//CHECK#8 +if ("\u0008" !== String.fromCharCode("8")) { + $ERROR('#8: "\\u0008" === String.fromCharCode("8")'); +} + +//CHECK#9 +if ("\u0009" !== String.fromCharCode("9")) { + $ERROR('#9: "\\u0009" === String.fromCharCode("9")'); +} + +//CHECK#A +if ("\u000A" !== String.fromCharCode("10")) { + $ERROR('#A: "\\u000A" === String.fromCharCode("10")'); +} + +//CHECK#B +if ("\u000B" !== String.fromCharCode("11")) { + $ERROR('#B: "\\u000B" === String.fromCharCode("11")'); +} + +//CHECK#C +if ("\u000C" !== String.fromCharCode("12")) { + $ERROR('#C: "\\u000C" === String.fromCharCode("12")'); +} + +//CHECK#D +if ("\u000D" !== String.fromCharCode("13")) { + $ERROR('#D: "\\u000D" === String.fromCharCode("13")'); +} + +//CHECK#E +if ("\u000E" !== String.fromCharCode("14")) { + $ERROR('#E: "\\u000E" === String.fromCharCode("14")'); +} + +//CHECK#F +if ("\u000F" !== String.fromCharCode("15")) { + $ERROR('#F: "\\u000F" === String.fromCharCode("15")'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T2.js new file mode 100644 index 0000000000..485d26d670 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit + HexDigit +es5id: 7.8.4_A7.1_T2 +description: "UnicodeEscapeSequence :: ENGLISH CAPITAL ALPHABET" +---*/ + +//CHECK#A-Z +var unicode = ["\u0041", "\u0042", "\u0043", "\u0044", "\u0045", "\u0046", "\u0047", "\u0048", "\u0049", "\u004A", "\u004B", "\u004C", "\u004D", "\u004E", "\u004F", "\u0050", "\u0051", "\u0052", "\u0053", "\u0054", "\u0055", "\u0056", "\u0057", "\u0058", "\u0059", "\u005A"]; +var character = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +for (var index = 0; index <= 25; index++) { + if (unicode[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T3.js new file mode 100644 index 0000000000..9a6035cd3b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit + HexDigit +es5id: 7.8.4_A7.1_T3 +description: "UnicodeEscapeSequence :: ENGLISH SMALL ALPHABET" +---*/ + +//CHECK#a-z +var unicode = ["\u0061", "\u0062", "\u0063", "\u0064", "\u0065", "\u0066", "\u0067", "\u0068", "\u0069", "\u006A", "\u006B", "\u006C", "\u006D", "\u006E", "\u006F", "\u0070", "\u0071", "\u0072", "\u0073", "\u0074", "\u0075", "\u0076", "\u0077", "\u0078", "\u0079", "\u007A"]; +var character = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var index = 0; index <= 25; index++) { + if (unicode[index] !== character[index]) { + $ERROR('#' + character[index] + ' '); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T4.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T4.js new file mode 100644 index 0000000000..bd1b245899 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.1_T4.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + EscapeSequence :: UnicodeEscapeSequence :: u HexDigit HexDigit HexDigit + HexDigit +es5id: 7.8.4_A7.1_T4 +description: "UnicodeEscapeSequence :: u000G is incorrect" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK# +"\u000G" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T1.js new file mode 100644 index 0000000000..7bcbb19995 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T1.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T1 +description: ":: HexDigit :: 1" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\u1" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T2.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T2.js new file mode 100644 index 0000000000..f3be7fe4b2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T2.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T2 +description: ":: HexDigit :: A" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\uA" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T3.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T3.js new file mode 100644 index 0000000000..56653c6b5b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T3.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T3 +description: ":: HexDigit :: 1" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\u11" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T4.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T4.js new file mode 100644 index 0000000000..56706fb2b4 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T4.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T4 +description: ":: HexDigit :: A" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\uAA" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T5.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T5.js new file mode 100644 index 0000000000..4844492a87 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T5.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T5 +description: ":: HexDigit :: 1" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\u111" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T6.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T6.js new file mode 100644 index 0000000000..b948f46099 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.2_T6.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "UnicodeEscapeSequence :: u HexDigit (one, two or three time) is incorrect" +es5id: 7.8.4_A7.2_T6 +description: ":: HexDigit :: A" +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +//CHECK#1 +"\uAAA" diff --git a/js/src/tests/test262/language/literals/string/S7.8.4_A7.3_T1.js b/js/src/tests/test262/language/literals/string/S7.8.4_A7.3_T1.js new file mode 100644 index 0000000000..76b99ecd04 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/S7.8.4_A7.3_T1.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: \u HexDigit HexDigit HexDigit HexDigit DoubleStringCharacter +es5id: 7.8.4_A7.3_T1 +description: Check similar to ("\u0001F" === String.fromCharCode("1") + "F") +---*/ + +//CHECK#1 +if ("\u0001F" !== String.fromCharCode("1") + "F") { + $ERROR('#1: "\\u0001F" === String.fromCharCode("1") + "F"'); +} + +//CHECK#2 +if ("\u0002E" !== String.fromCharCode("2") + "E") { + $ERROR('#2: "\\u0002E" === String.fromCharCode("2") + "E"'); +} + +//CHECK#3 +if ("\u0003D" !== String.fromCharCode("3") + "D") { + $ERROR('#3: "\\u0003D" === String.fromCharCode("3") + "D"'); +} + +//CHECK#4 +if ("\u0004C" !== String.fromCharCode("4") + "C") { + $ERROR('#4: "\\u0004C" === String.fromCharCode("4") + "C"'); +} + +//CHECK#5 +if ("\u0005B" !== String.fromCharCode("5") + "B") { + $ERROR('#5: "\\u0005B" === String.fromCharCode("5") + "B"'); +} + +//CHECK#6 +if ("\u0006A" !== String.fromCharCode("6") + "A") { + $ERROR('#6: "\\u0006A" === String.fromCharCode("6") + "A"'); +} + +//CHECK#7 +if ("\u00079" !== String.fromCharCode("7") + "9") { + $ERROR('#7: "\\u00079" === String.fromCharCode("7") + "9"'); +} + +//CHECK#8 +if ("\u00088" !== String.fromCharCode("8") + "8") { + $ERROR('#8: "\\u00088" === String.fromCharCode("8") + "8"'); +} + +//CHECK#9 +if ("\u00097" !== String.fromCharCode("9") + "7") { + $ERROR('#9: "\\u00097" === String.fromCharCode("9") + "7"'); +} + +//CHECK#A +if ("\u000A6" !== String.fromCharCode("10") + "6") { + $ERROR('#A: "\\u000A6" === String.fromCharCode("10") + "6"'); +} + +//CHECK#B +if ("\u000B5" !== String.fromCharCode("11") + "5") { + $ERROR('#B: "\\u000B5" === String.fromCharCode("11") + "5"'); +} + +//CHECK#C +if ("\u000C4" !== String.fromCharCode("12") + "4") { + $ERROR('#C: "\\u000C4" === String.fromCharCode("12") + "4"'); +} + +//CHECK#D +if ("\u000D3" !== String.fromCharCode("13") + "3") { + $ERROR('#D: "\\u000D3" === String.fromCharCode("13") + "3"'); +} + +//CHECK#E +if ("\u000E2" !== String.fromCharCode("14") + "2") { + $ERROR('#E: "\\u000E2" === String.fromCharCode("14") + "2"'); +} + +//CHECK#F +if ("\u000F1" !== String.fromCharCode("15") + "1") { + $ERROR('#F: "\\u000F1" === String.fromCharCode("15") + "1"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/browser.js b/js/src/tests/test262/language/literals/string/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/browser.js diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-1-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-1-strict-explicit-pragma.js new file mode 100644 index 0000000000..9bbcb6ea0c --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-1-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; ZeroToThree 1 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + ZeroToThree::one of + 0 1 2 3 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\1"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-2-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-2-strict-explicit-pragma.js new file mode 100644 index 0000000000..6e4d343074 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-2-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; ZeroToThree 2 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + ZeroToThree::one of + 0 1 2 3 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\2"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-3-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-3-strict-explicit-pragma.js new file mode 100644 index 0000000000..199aea6e0b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-3-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; ZeroToThree 3 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + ZeroToThree::one of + 0 1 2 3 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\3"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-4-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-4-strict-explicit-pragma.js new file mode 100644 index 0000000000..09e7685955 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-4-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; FourToSeven 4 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + FourToSeven::one of + 4 5 6 7 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\4"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-5-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-5-strict-explicit-pragma.js new file mode 100644 index 0000000000..7a2ed8486c --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-5-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; FourToSeven 5 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + FourToSeven::one of + 4 5 6 7 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\5"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-6-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-6-strict-explicit-pragma.js new file mode 100644 index 0000000000..9eea1c947d --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-6-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; FourToSeven 6 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + FourToSeven::one of + 4 5 6 7 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\6"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-7-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-7-strict-explicit-pragma.js new file mode 100644 index 0000000000..fa5220edbc --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-7-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; FourToSeven 7 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + FourToSeven::one of + 4 5 6 7 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\7"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-explicit-pragma.js new file mode 100644 index 0000000000..3ab6c4c23f --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; NonOctalDecimalEscapeSequence 8 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + NonOctalDecimalEscapeSequence::one of + 8 9 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\8"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-strict.js new file mode 100644 index 0000000000..e7bbd63101 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Sony Interactive Entertainment Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + LegacyOctalEscapeSequence is not enabled in strict mode code + (regardless of the presence of Annex B) +info: | + A conforming implementation, when processing strict mode code, must not extend the + syntax of EscapeSequence to include LegacyOctalEscapeSequence as described in B.1.2. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\8'; diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-explicit-pragma.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-explicit-pragma.js new file mode 100644 index 0000000000..13fea4f540 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-explicit-pragma.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +description: > + String Literals extensions disallowed in strict mode; NonOctalDecimalEscapeSequence 9 +info: | + It is possible for string literals to precede a Use Strict Directive that places the enclosing + code in strict mode, and implementations must take care to not use this extended definition of + EscapeSequence with such literals. For example, attempting to parse the following source text + must fail. + + Strict mode is entered via the explicit Use Strict Directive. + + NonOctalDecimalEscapeSequence::one of + 8 9 + +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function invalid() { "\9"; "use strict"; } diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-strict.js new file mode 100644 index 0000000000..7a5d68113a --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Sony Interactive Entertainment Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-literals-string-literals +description: > + LegacyOctalEscapeSequence is not enabled in strict mode code + (regardless of the presence of Annex B) +info: | + A conforming implementation, when processing strict mode code, must not extend the + syntax of EscapeSequence to include LegacyOctalEscapeSequence as described in B.1.2. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\9'; diff --git a/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-strict-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-strict-strict.js new file mode 100644 index 0000000000..c4d7d97d09 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-strict-strict.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2017 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +es6id: B.1.2 +description: > + LegacyOctalEscapeSequence is not enabled in strict mode code (regardless of + the presence of Annex B) +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + LegacyOctalEscapeSequence :: + OctalDigit [lookahead ∉ OctalDigit] + ZeroToThree OctalDigit [lookahead ∉ OctalDigit] + FourToSeven OctalDigit + ZeroToThree OctalDigit OctalDigit + + ZeroToThree :: one of + 0 1 2 3 + + FourToSeven :: one of + 4 5 6 7 + + This definition of EscapeSequence is not used in strict mode or when + parsing TemplateCharacter. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\08'; diff --git a/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-prologue-strict.js b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-prologue-strict.js new file mode 100644 index 0000000000..5c769817e7 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-prologue-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.8.4-1-s +description: > + A directive preceding an 'use strict' directive may not contain + an OctalEscapeSequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(function() { + "asterisk: \052"; + "use strict"; +}); diff --git a/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-strict-strict.js b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-strict-strict.js new file mode 100644 index 0000000000..53a25fd3cb --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-strict-strict.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-additional-syntax-string-literals +es6id: B.1.2 +description: > + LegacyOctalEscapeSequence is not enabled in strict mode code (regardless of + the presence of Annex B) +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + LegacyOctalEscapeSequence :: + OctalDigit [lookahead ∉ OctalDigit] + ZeroToThree OctalDigit [lookahead ∉ OctalDigit] + FourToSeven OctalDigit + ZeroToThree OctalDigit OctalDigit + + ZeroToThree :: one of + 0 1 2 3 + + FourToSeven :: one of + 4 5 6 7 + + This definition of EscapeSequence is not used in strict mode or when + parsing TemplateCharacter. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\1'; diff --git a/js/src/tests/test262/language/literals/string/line-continuation-double.js b/js/src/tests/test262/language/literals/string/line-continuation-double.js new file mode 100644 index 0000000000..1ab165a4dd --- /dev/null +++ b/js/src/tests/test262/language/literals/string/line-continuation-double.js @@ -0,0 +1,62 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + Line terminators may occur within string literals as part of a |LineContinuation| + to produce the empty code points sequence. +info: | + 11.8.4 String Literals + + StringLiteral :: + `"` DoubleStringCharacters? `"` + `'` SingleStringCharacters? `'` + + DoubleStringCharacters :: + DoubleStringCharacter DoubleStringCharacters? + + DoubleStringCharacter :: + SourceCharacter but not one of `"` or `\` or LineTerminator + <LS> + <PS> + `\` EscapeSequence + LineContinuation + + LineContinuation :: + `\` LineTerminatorSequence + + 11.3 Line Terminators + + LineTerminatorSequence :: + <LF> + <CR> [lookahead != <LF>] + <LS> + <PS> + <CR> <LF> + + 11.8.4.2 Static Semantics: SV + + The SV of DoubleStringCharacter :: LineContinuation is the empty code unit sequence. +---*/ + +// LineTerminatorSequence :: <LF> +assert.sameValue("\ +", ""); + +// LineTerminatorSequence :: <CR> [lookahead ≠ <LF>] +assert.sameValue("\
", ""); + +// LineTerminatorSequence :: <LS> +// <LS> is U+2028 LINE SEPARATOR; UTF8(0x2028) = 0xE2 0x80 0xA8 +assert.sameValue("\
", ""); + +// LineTerminatorSequence :: <PS> +// <PS> is U+2029 PARAGRAPH SEPARATOR; UTF8(0x2029) = 0xE2 0x80 0xA9 +assert.sameValue("\
", ""); + +// LineTerminatorSequence :: <CR> <LF> +assert.sameValue("\
+", ""); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/line-continuation-single.js b/js/src/tests/test262/language/literals/string/line-continuation-single.js new file mode 100644 index 0000000000..6c0a5184bf --- /dev/null +++ b/js/src/tests/test262/language/literals/string/line-continuation-single.js @@ -0,0 +1,62 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + Line terminators may occur within string literals as part of a |LineContinuation| + to produce the empty code points sequence. +info: | + 11.8.4 String Literals + + StringLiteral :: + `"` DoubleStringCharacters? `"` + `'` SingleStringCharacters? `'` + + SingleStringCharacters :: + SingleStringCharacter SingleStringCharacters? + + SingleStringCharacter :: + SourceCharacter but not one of `'` or `\` or LineTerminator + <LS> + <PS> + `\` EscapeSequence + LineContinuation + + LineContinuation :: + `\` LineTerminatorSequence + + 11.3 Line Terminators + + LineTerminatorSequence :: + <LF> + <CR> [lookahead != <LF>] + <LS> + <PS> + <CR> <LF> + + 11.8.4.2 Static Semantics: SV + + The SV of SingleStringCharacter :: LineContinuation is the empty code unit sequence. +---*/ + +// LineTerminatorSequence :: <LF> +assert.sameValue('\ +', ''); + +// LineTerminatorSequence :: <CR> [lookahead ≠ <LF>] +assert.sameValue('\
', ''); + +// LineTerminatorSequence :: <LS> +// <LS> is U+2028 LINE SEPARATOR; UTF8(0x2028) = 0xE2 0x80 0xA8 +assert.sameValue('\
', ''); + +// LineTerminatorSequence :: <PS> +// <PS> is U+2029 PARAGRAPH SEPARATOR; UTF8(0x2029) = 0xE2 0x80 0xA9 +assert.sameValue('\
', ''); + +// LineTerminatorSequence :: <CR> <LF> +assert.sameValue('\
+', ''); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/line-separator-eval.js b/js/src/tests/test262/language/literals/string/line-separator-eval.js new file mode 100644 index 0000000000..4eb677af99 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/line-separator-eval.js @@ -0,0 +1,19 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + U+2028 LINE SEPARATOR can appear in string literals (eval code). +info: | + 11.8.4 String Literals + + All code points may appear literally in a string literal except for the + closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), + and U+000A (LINE FEED). +features: [json-superset] +---*/ + +assert.sameValue(eval("'\u2028'"), "\u2028"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/line-separator.js b/js/src/tests/test262/language/literals/string/line-separator.js new file mode 100644 index 0000000000..86e9c507d7 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/line-separator.js @@ -0,0 +1,20 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + U+2028 LINE SEPARATOR can appear in string literals. +info: | + 11.8.4 String Literals + + All code points may appear literally in a string literal except for the + closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), + and U+000A (LINE FEED). +features: [json-superset] +---*/ + +// U+2028 in strings; UTF8(0x2028) = 0xE2 0x80 0xA8 +assert.sameValue("
", "\u2028"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/mongolian-vowel-separator-eval.js b/js/src/tests/test262/language/literals/string/mongolian-vowel-separator-eval.js new file mode 100644 index 0000000000..18dfeb32d8 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/mongolian-vowel-separator-eval.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-unicode-format-control-characters +description: > + Mongolian Vowel Separator can appear in string literals (eval code). +info: | + 11.1 Unicode Format-Control Characters + + The Unicode format-control characters (i.e., the characters in category “Cf” + in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT + MARK) are control codes used to control the formatting of a range of text in + the absence of higher-level protocols for this (such as mark-up languages). + + It is useful to allow format-control characters in source text to facilitate + editing and display. All format control characters may be used within comments, + and within string literals, template literals, and regular expression literals. +features: [u180e] +---*/ + +assert.sameValue(eval("'\u180E'"), "\u180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/mongolian-vowel-separator.js b/js/src/tests/test262/language/literals/string/mongolian-vowel-separator.js new file mode 100644 index 0000000000..7e4a99c815 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/mongolian-vowel-separator.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-unicode-format-control-characters +description: > + Mongolian Vowel Separator can appear in string literals. +info: | + 11.1 Unicode Format-Control Characters + + The Unicode format-control characters (i.e., the characters in category “Cf” + in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT + MARK) are control codes used to control the formatting of a range of text in + the absence of higher-level protocols for this (such as mark-up languages). + + It is useful to allow format-control characters in source text to facilitate + editing and display. All format control characters may be used within comments, + and within string literals, template literals, and regular expression literals. +features: [u180e] +---*/ + +// U+180E in strings; UTF8(0x180E) = 0xE1 0xA0 0x8E +assert.sameValue("", "\u180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/paragraph-separator-eval.js b/js/src/tests/test262/language/literals/string/paragraph-separator-eval.js new file mode 100644 index 0000000000..88d7ae6ae9 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/paragraph-separator-eval.js @@ -0,0 +1,19 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + U+2029 PARAGRAPH SEPARATOR can appear in string literals (eval code). +info: | + 11.8.4 String Literals + + All code points may appear literally in a string literal except for the + closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), + and U+000A (LINE FEED). +features: [json-superset] +---*/ + +assert.sameValue(eval("'\u2029'"), "\u2029"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/paragraph-separator.js b/js/src/tests/test262/language/literals/string/paragraph-separator.js new file mode 100644 index 0000000000..339e97f89f --- /dev/null +++ b/js/src/tests/test262/language/literals/string/paragraph-separator.js @@ -0,0 +1,20 @@ +// Copyright (C) 2018 Richard Gibson. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-literals-string-literals +description: > + U+2029 PARAGRAPH SEPARATOR can appear in string literals. +info: | + 11.8.4 String Literals + + All code points may appear literally in a string literal except for the + closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), + and U+000A (LINE FEED). +features: [json-superset] +---*/ + +// U+2029 in strings; UTF8(0x2029) = 0xE2 0x80 0xA9 +assert.sameValue("
", "\u2029"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/literals/string/shell.js b/js/src/tests/test262/language/literals/string/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/shell.js diff --git a/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-double.js b/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-double.js new file mode 100644 index 0000000000..11843f2c9b --- /dev/null +++ b/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-double.js @@ -0,0 +1,50 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-StringLiteral +description: NumericLiteralSeperator disallowed in unicode CodePoint sequence (DoubleStringCharacters) +info: | + StringLiteral:: + "DoubleStringCharacters opt" + 'SingleStringCharacters opt' + + DoubleStringCharacters:: + DoubleStringCharacter DoubleStringCharacters opt + + DoubleStringCharacter:: + SourceCharacter but not one of " or \ or LineTerminator + \ EscapeSequence + LineContinuation + + EscapeSequence:: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + uHex4Digits + u{CodePoint} + + CodePoint :: + HexDigit but only if MV of HexDigits ≤ 0x10FFFF + CodePointDigits but only if MV of HexDigits ≤ 0x10FFFF + + CodePointDigits :: + HexDigit + CodePointDigitsHexDigit + + HexDigit :: one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +features: [numeric-separator-literal] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +"\u{1F_639}" diff --git a/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-single.js b/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-single.js new file mode 100644 index 0000000000..3052d893ab --- /dev/null +++ b/js/src/tests/test262/language/literals/string/unicode-escape-nls-err-single.js @@ -0,0 +1,50 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-StringLiteral +description: NumericLiteralSeperator disallowed in unicode CodePoint sequence (DoubleStringCharacters) +info: | + StringLiteral:: + "DoubleStringCharacters opt" + 'SingleStringCharacters opt' + + SingleStringCharacters:: + SingleStringCharacterSingleStringCharactersopt + + SingleStringCharacter:: + SourceCharacterbut not one of ' or \ or LineTerminator + \ EscapeSequence + LineContinuation + + EscapeSequence:: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + uHex4Digits + u{CodePoint} + + CodePoint :: + HexDigit but only if MV of HexDigits ≤ 0x10FFFF + CodePointDigits but only if MV of HexDigits ≤ 0x10FFFF + + CodePointDigits :: + HexDigit + CodePointDigitsHexDigit + + HexDigit :: one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +features: [numeric-separator-literal] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\u{1F_639}'; diff --git a/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-double.js b/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-double.js new file mode 100644 index 0000000000..afa71f94b1 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-double.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-StringLiteral +description: > + \u is at the end of string, Hex4Digits is required. +info: | + StringLiteral :: + " DoubleStringCharacters_opt " + ' SingleStringCharacters_opt ' + + DoubleStringCharacters :: + DoubleStringCharacter DoubleStringCharacters_opt + + DoubleStringCharacter :: + SourceCharacter but not one of " or \ or LineTerminator + <LS> + <PS> + \ EscapeSequence + LineContinuation + + EscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + u Hex4Digits + u{ CodePoint } + + Hex4Digits :: + HexDigit HexDigit HexDigit HexDigit + + HexDigit :: one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +"\u" diff --git a/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-single.js b/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-single.js new file mode 100644 index 0000000000..b6cadf80a1 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/unicode-escape-no-hex-err-single.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-StringLiteral +description: > + \u is at the end of string, Hex4Digits is required. +info: | + StringLiteral :: + " DoubleStringCharacters_opt " + ' SingleStringCharacters_opt ' + + SingleStringCharacters :: + SingleStringCharacter SingleStringCharacters_opt + + SingleStringCharacter :: + SourceCharacter but not one of ' or \ or LineTerminator + <LS> + <PS> + \ EscapeSequence + LineContinuation + + EscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + u Hex4Digits + u{ CodePoint } + + Hex4Digits :: + HexDigit HexDigit HexDigit HexDigit + + HexDigit :: one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\u' |