diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/literals/string | |
parent | Initial commit. (diff) | |
download | firefox-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/language/literals/string')
75 files changed, 2577 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..606999088b --- /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]) { + throw new Test262Error('#' + 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..78687d79e0 --- /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]) { + throw new Test262Error('#' + 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..cc92a4ad3c --- /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]) { + throw new Test262Error('#' + 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..5e0e36fa6a --- /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]) { + throw new Test262Error('#' + 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..b2c3b92ee6 --- /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]) { + throw new Test262Error('#' + 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..20f0cbb71d --- /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") { + throw new Test262Error('#1: String.fromCharCode(0x0008) === "\\b"'); +} + +//CHECK#2 +if (String.fromCharCode(0x0009) !== "\t") { + throw new Test262Error('#2: String.fromCharCode(0x0009) === "\\t"'); +} + +//CHECK#3 +if (String.fromCharCode(0x000A) !== "\n") { + throw new Test262Error('#3: String.fromCharCode(0x000A) === "\\n"'); +} + +//CHECK#4 +if (String.fromCharCode(0x000B) !== "\v") { + throw new Test262Error('#4: String.fromCharCode(0x000B) === "\\v"'); +} + +//CHECK#5 +if (String.fromCharCode(0x000C) !== "\f") { + throw new Test262Error('#5: String.fromCharCode(0x000C) === "\\f"'); +} + +//CHECK#6 +if (String.fromCharCode(0x000D) !== "\r") { + throw new Test262Error('#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..ca64058507 --- /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) !== "\'") { + throw new Test262Error('#1: String.fromCharCode(0x0027) === "\\\'"'); +} + +//CHECK#2 +if (String.fromCharCode(0x0022) !== '\"') { + throw new Test262Error('#2: String.fromCharCode(0x0027) === \'\\\"\''); +} + +//CHECK#3 +if (String.fromCharCode(0x005C) !== "\\") { + throw new Test262Error('#3: String.fromCharCode(0x005C) === "\\\"'); +} + +//CHECK#4 +if ("\'" !== "'") { + throw new Test262Error('#4: "\'" === "\\\'"'); +} + +//CHECK#5 +if ('\"' !== '"') { + throw new Test262Error('#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..2abf1e9510 --- /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]) { + throw new Test262Error('#' + 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..e1680f7815 --- /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") { + throw new Test262Error('#A'); +} + +if ("B" !== "\B") { + throw new Test262Error('#B'); +} + +if ("C" !== "\C") { + throw new Test262Error('#C'); +} + +if ("D" !== "\D") { + throw new Test262Error('#D'); +} + +if ("E" !== "\E") { + throw new Test262Error('#E'); +} + +if ("F" !== "\F") { + throw new Test262Error('#F'); +} + +if ("G" !== "\G") { + throw new Test262Error('#G'); +} + +if ("H" !== "\H") { + throw new Test262Error('#H'); +} + +if ("I" !== "\I") { + throw new Test262Error('#I'); +} + +if ("J" !== "\J") { + throw new Test262Error('#J'); +} + +if ("K" !== "\K") { + throw new Test262Error('#K'); +} + +if ("L" !== "\L") { + throw new Test262Error('#L'); +} + +if ("M" !== "\M") { + throw new Test262Error('#M'); +} + +if ("N" !== "\N") { + throw new Test262Error('#N'); +} + +if ("O" !== "\O") { + throw new Test262Error('#O'); +} + +if ("P" !== "\P") { + throw new Test262Error('#P'); +} + +if ("Q" !== "\Q") { + throw new Test262Error('#Q'); +} + +if ("R" !== "\R") { + throw new Test262Error('#R'); +} + +if ("S" !== "\S") { + throw new Test262Error('#S'); +} + +if ("T" !== "\T") { + throw new Test262Error('#T'); +} + +if ("U" !== "\U") { + throw new Test262Error('#U'); +} + +if ("V" !== "\V") { + throw new Test262Error('#V'); +} + +if ("W" !== "\W") { + throw new Test262Error('#W'); +} + +if ("X" !== "\X") { + throw new Test262Error('#X'); +} + +if ("Y" !== "\Y") { + throw new Test262Error('#Y'); +} + +if ("Z" !== "\Z") { + throw new Test262Error('#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..bd0517559c --- /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]) { + throw new Test262Error('#' + 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..6c40a47570 --- /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") { + throw new Test262Error('#a'); +} + +if ("c" !== "\c") { + throw new Test262Error('#c'); +} + +if ("d" !== "\d") { + throw new Test262Error('#d'); +} + +if ("e" !== "\e") { + throw new Test262Error('#e'); +} + +if ("g" !== "\g") { + throw new Test262Error('#g'); +} + +if ("h" !== "\h") { + throw new Test262Error('#h'); +} + +if ("i" !== "\i") { + throw new Test262Error('#i'); +} + +if ("j" !== "\j") { + throw new Test262Error('#j'); +} + +if ("k" !== "\k") { + throw new Test262Error('#k'); +} + +if ("l" !== "\l") { + throw new Test262Error('#l'); +} + +if ("m" !== "\m") { + throw new Test262Error('#m'); +} + + +if ("o" !== "\o") { + throw new Test262Error('#o'); +} + +if ("p" !== "\p") { + throw new Test262Error('#p'); +} + +if ("q" !== "\q") { + throw new Test262Error('#q'); +} + +if ("s" !== "\s") { + throw new Test262Error('#s'); +} + +if ("w" !== "\w") { + throw new Test262Error('#w'); +} + +if ("y" !== "\y") { + throw new Test262Error('#y'); +} + +if ("z" !== "\z") { + throw new Test262Error('#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..ec04dceb0e --- /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]) { + throw new Test262Error('#' + 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..0d9aef2591 --- /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 ("А" !== "\А") { + throw new Test262Error('#А'); +} + +if ("Б" !== "\Б") { + throw new Test262Error('#Б'); +} + +if ("В" !== "\В") { + throw new Test262Error('#В'); +} + +if ("Г" !== "\Г") { + throw new Test262Error('#Г'); +} + +if ("Д" !== "\Д") { + throw new Test262Error('#Д'); +} + +if ("Е" !== "\Е") { + throw new Test262Error('#Е'); +} + +if ("Ж" !== "\Ж") { + throw new Test262Error('#Ж'); +} + +if ("З" !== "\З") { + throw new Test262Error('#З'); +} + +if ("И" !== "\И") { + throw new Test262Error('#И'); +} + +if ("Й" !== "\Й") { + throw new Test262Error('#Й'); +} + +if ("К" !== "\К") { + throw new Test262Error('#К'); +} + +if ("Л" !== "\Л") { + throw new Test262Error('#Л'); +} + +if ("М" !== "\М") { + throw new Test262Error('#М'); +} + +if ("Н" !== "\Н") { + throw new Test262Error('#Н'); +} + +if ("О" !== "\О") { + throw new Test262Error('#О'); +} + +if ("П" !== "\П") { + throw new Test262Error('#П'); +} + +if ("Р" !== "\Р") { + throw new Test262Error('#Р'); +} + +if ("С" !== "\С") { + throw new Test262Error('#С'); +} + +if ("Т" !== "\Т") { + throw new Test262Error('#Т'); +} + +if ("У" !== "\У") { + throw new Test262Error('#У'); +} + +if ("Ф" !== "\Ф") { + throw new Test262Error('#Ф'); +} + +if ("Х" !== "\Х") { + throw new Test262Error('#Х'); +} + +if ("Ц" !== "\Ц") { + throw new Test262Error('#Ц'); +} + +if ("Ч" !== "\Ч") { + throw new Test262Error('#Ч'); +} + +if ("Ш" !== "\Ш") { + throw new Test262Error('#Ш'); +} + +if ("Щ" !== "\Щ") { + throw new Test262Error('#Щ'); +} + +if ("Ъ" !== "\Ъ") { + throw new Test262Error('#Ъ'); +} + +if ("Ы" !== "\Ы") { + throw new Test262Error('#Ы'); +} + +if ("Ь" !== "\Ь") { + throw new Test262Error('#Ь'); +} + +if ("Э" !== "\Э") { + throw new Test262Error('#Э'); +} + +if ("Ю" !== "\Ю") { + throw new Test262Error('#Ю'); +} + +if ("Я" !== "\Я") { + throw new Test262Error('#Я'); +} + +if ("Ё" !== "\Ё") { + throw new Test262Error('#Ё'); +} + +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..fa11e5f18a --- /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]) { + throw new Test262Error('#' + 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..77ae7179e6 --- /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 ("а" !== "\а") { + throw new Test262Error('#а'); +} + +if ("б" !== "\б") { + throw new Test262Error('#б'); +} + +if ("в" !== "\в") { + throw new Test262Error('#в'); +} + +if ("г" !== "\г") { + throw new Test262Error('#г'); +} + +if ("д" !== "\д") { + throw new Test262Error('#д'); +} + +if ("е" !== "\е") { + throw new Test262Error('#е'); +} + +if ("ж" !== "\ж") { + throw new Test262Error('#ж'); +} + +if ("з" !== "\з") { + throw new Test262Error('#з'); +} + +if ("и" !== "\и") { + throw new Test262Error('#и'); +} + +if ("й" !== "\й") { + throw new Test262Error('#й'); +} + +if ("к" !== "\к") { + throw new Test262Error('#к'); +} + +if ("л" !== "\л") { + throw new Test262Error('#л'); +} + +if ("м" !== "\м") { + throw new Test262Error('#м'); +} + +if ("н" !== "\н") { + throw new Test262Error('#н'); +} + +if ("о" !== "\о") { + throw new Test262Error('#о'); +} + +if ("п" !== "\п") { + throw new Test262Error('#п'); +} + +if ("р" !== "\р") { + throw new Test262Error('#р'); +} + +if ("с" !== "\с") { + throw new Test262Error('#с'); +} + +if ("т" !== "\т") { + throw new Test262Error('#т'); +} + +if ("у" !== "\у") { + throw new Test262Error('#у'); +} + +if ("ф" !== "\ф") { + throw new Test262Error('#ф'); +} + +if ("х" !== "\х") { + throw new Test262Error('#х'); +} + +if ("ц" !== "\ц") { + throw new Test262Error('#ц'); +} + +if ("ч" !== "\ч") { + throw new Test262Error('#ч'); +} + +if ("ш" !== "\ш") { + throw new Test262Error('#ш'); +} + +if ("щ" !== "\щ") { + throw new Test262Error('#щ'); +} + +if ("ъ" !== "\ъ") { + throw new Test262Error('#ъ'); +} + +if ("ы" !== "\ы") { + throw new Test262Error('#ы'); +} + +if ("ь" !== "\ь") { + throw new Test262Error('#ь'); +} + +if ("э" !== "\э") { + throw new Test262Error('#э'); +} + +if ("ю" !== "\ю") { + throw new Test262Error('#ю'); +} + +if ("я" !== "\я") { + throw new Test262Error('#я'); +} + +if ("ё" !== "\ё") { + throw new Test262Error('#ё'); +} + +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..6f21c6ce1c --- /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") { + throw new Test262Error('#b'); +} + +if ("f" === "\f") { + throw new Test262Error('#f'); +} + +if ("n" === "\n") { + throw new Test262Error('#n'); +} + +if ("r" === "\r") { + throw new Test262Error('#r'); +} + +if ("t" === "\t") { + throw new Test262Error('#t'); +} + +if ("v" === "\v") { + throw new Test262Error('#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..99d42c9e38 --- /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") { + throw new Test262Error('#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..3a7c1f7c6d --- /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") { + throw new Test262Error('#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..f1d7d0ebf1 --- /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") { + throw new Test262Error('#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..3c10fc9c32 --- /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")) { + throw new Test262Error('#0: "\\x00" === String.fromCharCode("0")'); +} + +//CHECK#1 +if ("\x01" !== String.fromCharCode("1")) { + throw new Test262Error('#1: "\\x01" === String.fromCharCode("1")'); +} + +//CHECK#2 +if ("\x02" !== String.fromCharCode("2")) { + throw new Test262Error('#2: "\\x02" === String.fromCharCode("2")'); +} + +//CHECK#3 +if ("\x03" !== String.fromCharCode("3")) { + throw new Test262Error('#3: "\\x03" === String.fromCharCode("3")'); +} + +//CHECK#4 +if ("\x04" !== String.fromCharCode("4")) { + throw new Test262Error('#4: "\\x04" === String.fromCharCode("4")'); +} + +//CHECK#5 +if ("\x05" !== String.fromCharCode("5")) { + throw new Test262Error('#5: "\\x05" === String.fromCharCode("5")'); +} + +//CHECK#6 +if ("\x06" !== String.fromCharCode("6")) { + throw new Test262Error('#6: "\\x06" === String.fromCharCode("6")'); +} + +//CHECK#7 +if ("\x07" !== String.fromCharCode("7")) { + throw new Test262Error('#7: "\\x07" === String.fromCharCode("7")'); +} + +//CHECK#8 +if ("\x08" !== String.fromCharCode("8")) { + throw new Test262Error('#8: "\\x08" === String.fromCharCode("8")'); +} + +//CHECK#9 +if ("\x09" !== String.fromCharCode("9")) { + throw new Test262Error('#9: "\\x09" === String.fromCharCode("9")'); +} + +//CHECK#A +if ("\x0A" !== String.fromCharCode("10")) { + throw new Test262Error('#A: "\\x0A" === String.fromCharCode("10")'); +} + +//CHECK#B +if ("\x0B" !== String.fromCharCode("11")) { + throw new Test262Error('#B: "\\x0B" === String.fromCharCode("11")'); +} + +//CHECK#C +if ("\x0C" !== String.fromCharCode("12")) { + throw new Test262Error('#C: "\\x0C" === String.fromCharCode("12")'); +} + +//CHECK#D +if ("\x0D" !== String.fromCharCode("13")) { + throw new Test262Error('#D: "\\x0D" === String.fromCharCode("13")'); +} + +//CHECK#E +if ("\x0E" !== String.fromCharCode("14")) { + throw new Test262Error('#E: "\\x0E" === String.fromCharCode("14")'); +} + +//CHECK#F +if ("\x0F" !== String.fromCharCode("15")) { + throw new Test262Error('#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..7f44b73513 --- /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]) { + throw new Test262Error('#' + 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..4ddbac2dc9 --- /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]) { + throw new Test262Error('#' + 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..9fda157510 --- /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') { + throw new Test262Error("#1: '\x01F' === String.fromCharCode('1') + 'F'"); +} + +//CHECK#2 +if ('\x02E' !== String.fromCharCode('2') + 'E') { + throw new Test262Error("#2: '\x02E' === String.fromCharCode('2') + 'E'"); +} + +//CHECK#3 +if ('\x03D' !== String.fromCharCode('3') + 'D') { + throw new Test262Error("#3: '\x03D' === String.fromCharCode('3') + 'D'"); +} + +//CHECK#4 +if ('\x04C' !== String.fromCharCode('4') + 'C') { + throw new Test262Error("#4: '\x04C' === String.fromCharCode('4') + 'C'"); +} + +//CHECK#5 +if ('\x05B' !== String.fromCharCode('5') + 'B') { + throw new Test262Error("#5: '\x05B' === String.fromCharCode('5') + 'B'"); +} + +//CHECK#6 +if ('\x06A' !== String.fromCharCode('6') + 'A') { + throw new Test262Error("#6: '\x06A' === String.fromCharCode('6') + 'A'"); +} + +//CHECK#7 +if ('\x079' !== String.fromCharCode('7') + '9') { + throw new Test262Error("#7: '\x079' === String.fromCharCode('7') + '9'"); +} + +//CHECK#8 +if ('\x088' !== String.fromCharCode('8') + '8') { + throw new Test262Error("#8: '\x088' === String.fromCharCode('8') + '8'"); +} + +//CHECK#9 +if ('\x097' !== String.fromCharCode('9') + '7') { + throw new Test262Error("#9: '\x097' === String.fromCharCode('9') + '7'"); +} + +//CHECK#A +if ('\x0A6' !== String.fromCharCode('10') + '6') { + throw new Test262Error("#A: '\x0A6' === String.fromCharCode('10') + '6'"); +} + +//CHECK#B +if ('\x0B5' !== String.fromCharCode('11') + '5') { + throw new Test262Error("#B: '\x0B5' === String.fromCharCode('11') + '5'"); +} + +//CHECK#C +if ('\x0C4' !== String.fromCharCode('12') + '4') { + throw new Test262Error("#C: '\x0C4' === String.fromCharCode('12') + '4'"); +} + +//CHECK#D +if ('\x0D3' !== String.fromCharCode('13') + '3') { + throw new Test262Error("#D: '\x0D3' === String.fromCharCode('13') + '3'"); +} + +//CHECK#E +if ('\x0E2' !== String.fromCharCode('14') + '2') { + throw new Test262Error("#E: '\x0E2' === String.fromCharCode('14') + '2'"); +} + +//CHECK#F +if ('\x0F1' !== String.fromCharCode('15') + '1') { + throw new Test262Error("#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..f37b3437d1 --- /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")) { + throw new Test262Error('#0: "\\u0000" === String.fromCharCode("0")'); +} + +//CHECK#1 +if ("\u0001" !== String.fromCharCode("1")) { + throw new Test262Error('#1: "\\u0001" === String.fromCharCode("1")'); +} + +//CHECK#2 +if ("\u0002" !== String.fromCharCode("2")) { + throw new Test262Error('#2: "\\u0002" === String.fromCharCode("2")'); +} + +//CHECK#3 +if ("\u0003" !== String.fromCharCode("3")) { + throw new Test262Error('#3: "\\u0003" === String.fromCharCode("3")'); +} + +//CHECK#4 +if ("\u0004" !== String.fromCharCode("4")) { + throw new Test262Error('#4: "\\u0004" === String.fromCharCode("4")'); +} + +//CHECK#5 +if ("\u0005" !== String.fromCharCode("5")) { + throw new Test262Error('#5: "\\u0005" === String.fromCharCode("5")'); +} + +//CHECK#6 +if ("\u0006" !== String.fromCharCode("6")) { + throw new Test262Error('#6: "\\u0006" === String.fromCharCode("6")'); +} + +//CHECK#7 +if ("\u0007" !== String.fromCharCode("7")) { + throw new Test262Error('#7: "\\u0007" === String.fromCharCode("7")'); +} + +//CHECK#8 +if ("\u0008" !== String.fromCharCode("8")) { + throw new Test262Error('#8: "\\u0008" === String.fromCharCode("8")'); +} + +//CHECK#9 +if ("\u0009" !== String.fromCharCode("9")) { + throw new Test262Error('#9: "\\u0009" === String.fromCharCode("9")'); +} + +//CHECK#A +if ("\u000A" !== String.fromCharCode("10")) { + throw new Test262Error('#A: "\\u000A" === String.fromCharCode("10")'); +} + +//CHECK#B +if ("\u000B" !== String.fromCharCode("11")) { + throw new Test262Error('#B: "\\u000B" === String.fromCharCode("11")'); +} + +//CHECK#C +if ("\u000C" !== String.fromCharCode("12")) { + throw new Test262Error('#C: "\\u000C" === String.fromCharCode("12")'); +} + +//CHECK#D +if ("\u000D" !== String.fromCharCode("13")) { + throw new Test262Error('#D: "\\u000D" === String.fromCharCode("13")'); +} + +//CHECK#E +if ("\u000E" !== String.fromCharCode("14")) { + throw new Test262Error('#E: "\\u000E" === String.fromCharCode("14")'); +} + +//CHECK#F +if ("\u000F" !== String.fromCharCode("15")) { + throw new Test262Error('#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..4bae42c896 --- /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]) { + throw new Test262Error('#' + 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..ea5181adb2 --- /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]) { + throw new Test262Error('#' + 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..8c8b43911d --- /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") { + throw new Test262Error('#1: "\\u0001F" === String.fromCharCode("1") + "F"'); +} + +//CHECK#2 +if ("\u0002E" !== String.fromCharCode("2") + "E") { + throw new Test262Error('#2: "\\u0002E" === String.fromCharCode("2") + "E"'); +} + +//CHECK#3 +if ("\u0003D" !== String.fromCharCode("3") + "D") { + throw new Test262Error('#3: "\\u0003D" === String.fromCharCode("3") + "D"'); +} + +//CHECK#4 +if ("\u0004C" !== String.fromCharCode("4") + "C") { + throw new Test262Error('#4: "\\u0004C" === String.fromCharCode("4") + "C"'); +} + +//CHECK#5 +if ("\u0005B" !== String.fromCharCode("5") + "B") { + throw new Test262Error('#5: "\\u0005B" === String.fromCharCode("5") + "B"'); +} + +//CHECK#6 +if ("\u0006A" !== String.fromCharCode("6") + "A") { + throw new Test262Error('#6: "\\u0006A" === String.fromCharCode("6") + "A"'); +} + +//CHECK#7 +if ("\u00079" !== String.fromCharCode("7") + "9") { + throw new Test262Error('#7: "\\u00079" === String.fromCharCode("7") + "9"'); +} + +//CHECK#8 +if ("\u00088" !== String.fromCharCode("8") + "8") { + throw new Test262Error('#8: "\\u00088" === String.fromCharCode("8") + "8"'); +} + +//CHECK#9 +if ("\u00097" !== String.fromCharCode("9") + "7") { + throw new Test262Error('#9: "\\u00097" === String.fromCharCode("9") + "7"'); +} + +//CHECK#A +if ("\u000A6" !== String.fromCharCode("10") + "6") { + throw new Test262Error('#A: "\\u000A6" === String.fromCharCode("10") + "6"'); +} + +//CHECK#B +if ("\u000B5" !== String.fromCharCode("11") + "5") { + throw new Test262Error('#B: "\\u000B5" === String.fromCharCode("11") + "5"'); +} + +//CHECK#C +if ("\u000C4" !== String.fromCharCode("12") + "4") { + throw new Test262Error('#C: "\\u000C4" === String.fromCharCode("12") + "4"'); +} + +//CHECK#D +if ("\u000D3" !== String.fromCharCode("13") + "3") { + throw new Test262Error('#D: "\\u000D3" === String.fromCharCode("13") + "3"'); +} + +//CHECK#E +if ("\u000E2" !== String.fromCharCode("14") + "2") { + throw new Test262Error('#E: "\\u000E2" === String.fromCharCode("14") + "2"'); +} + +//CHECK#F +if ("\u000F1" !== String.fromCharCode("15") + "1") { + throw new Test262Error('#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..b1d75b3a2e --- /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-literals-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..4381495669 --- /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-literals-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..93b2d1306e --- /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-literals-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..a53534a08a --- /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-literals-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..a5bed9e50b --- /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-literals-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..be50392eb2 --- /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-literals-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..f592280dc8 --- /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-literals-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-non-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-non-strict.js new file mode 100644 index 0000000000..666f2f74fe --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-non-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 the V8 project authors. 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 available in non-strict code - 8 +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + NonOctalDecimalEscapeSequence :: one of + 8 9 +flags: [noStrict] +---*/ + +assert.sameValue('\8', '8'); + +reportCompare(0, 0); 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..e85972d7bc --- /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-literals-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..9a5908a896 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-8-strict-strict.js @@ -0,0 +1,33 @@ +// |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 - 8 +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + NonOctalDecimalEscapeSequence :: one of + 8 9 + + ## 12.8.4.1 Static Semantics: Early Errors + + EscapeSequence :: NonOctalDecimalEscapeSequence + + - It is a Syntax Error if the source code matching this production is strict + mode code. +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-non-strict.js b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-non-strict.js new file mode 100644 index 0000000000..01b6d07f92 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-non-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 the V8 project authors. 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 available in non-strict code - 9 +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + NonOctalDecimalEscapeSequence :: one of + 8 9 +flags: [noStrict] +---*/ + +assert.sameValue('\9', '9'); + +reportCompare(0, 0); 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..6e8143c2ec --- /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-literals-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..dcdf0ad83e --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-9-strict-strict.js @@ -0,0 +1,33 @@ +// |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 - 9 +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + HexEscapeSequence + UnicodeEscapeSequence + + NonOctalDecimalEscapeSequence :: one of + 8 9 + + ## 12.8.4.1 Static Semantics: Early Errors + + EscapeSequence :: NonOctalDecimalEscapeSequence + + - It is a Syntax Error if the source code matching this production is strict + mode code. +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..454d99c4f1 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-non-octal-escape-sequence-strict-strict.js @@ -0,0 +1,29 @@ +// |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-template-literal-lexical-components +description: LegacyOctalEscapeSequence is not available in template literals +info: | + TemplateCharacter :: + $ [lookahead ≠ {] + \ TemplateEscapeSequence + \ NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacter but not one of ` or \ or $ or LineTerminator + TemplateEscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence +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..842ad7bc21 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence-strict-strict.js @@ -0,0 +1,29 @@ +// |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-template-literal-lexical-components +description: LegacyOctalEscapeSequence is not available in template literals +info: | + TemplateCharacter :: + $ [lookahead ≠ {] + \ TemplateEscapeSequence + \ NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacter but not one of ` or \ or $ or LineTerminator + TemplateEscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'\1'; diff --git a/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence.js b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence.js new file mode 100644 index 0000000000..4ec55368b3 --- /dev/null +++ b/js/src/tests/test262/language/literals/string/legacy-octal-escape-sequence.js @@ -0,0 +1,154 @@ +// 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-literals-string-literals +description: String value for LegacyOctalEscapeSequence +info: | + EscapeSequence :: + CharacterEscapeSequence + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence + 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 +flags: [noStrict] +---*/ + +// LegacyOctalEscapeSequence :: +// OctalDigit [lookahead ∉ OctalDigit] +assert.sameValue('\0', '\x00', '\\0'); +assert.sameValue('\1', '\x01', '\\1'); +assert.sameValue('\2', '\x02', '\\2'); +assert.sameValue('\3', '\x03', '\\3'); +assert.sameValue('\4', '\x04', '\\4'); +assert.sameValue('\5', '\x05', '\\5'); +assert.sameValue('\6', '\x06', '\\6'); +assert.sameValue('\7', '\x07', '\\7'); + +assert.sameValue('\08', '\x008', '\\08'); +assert.sameValue('\18', '\x018', '\\18'); +assert.sameValue('\28', '\x028', '\\28'); +assert.sameValue('\38', '\x038', '\\38'); +assert.sameValue('\48', '\x048', '\\48'); +assert.sameValue('\58', '\x058', '\\58'); +assert.sameValue('\68', '\x068', '\\68'); +assert.sameValue('\78', '\x078', '\\78'); +assert.sameValue('\08', '\x008', '\\08'); + +// LegacyOctalEscapeSequence :: +// ZeroToThree OctalDigit [lookahead ∉ OctalDigit] +assert.sameValue('\00', '\x00', '\\00'); +assert.sameValue('\01', '\x01', '\\01'); +assert.sameValue('\06', '\x06', '\\06'); +assert.sameValue('\07', '\x07', '\\07'); +assert.sameValue('\10', '\x08', '\\10'); +assert.sameValue('\11', '\x09', '\\11'); +assert.sameValue('\16', '\x0e', '\\16'); +assert.sameValue('\17', '\x0f', '\\17'); +assert.sameValue('\20', '\x10', '\\20'); +assert.sameValue('\21', '\x11', '\\21'); +assert.sameValue('\26', '\x16', '\\26'); +assert.sameValue('\27', '\x17', '\\27'); +assert.sameValue('\30', '\x18', '\\30'); +assert.sameValue('\31', '\x19', '\\31'); +assert.sameValue('\36', '\x1e', '\\36'); +assert.sameValue('\37', '\x1f', '\\37'); +assert.sameValue('\008', '\x008', '\\008'); +assert.sameValue('\018', '\x018', '\\018'); +assert.sameValue('\068', '\x068', '\\068'); +assert.sameValue('\078', '\x078', '\\078'); +assert.sameValue('\108', '\x088', '\\108'); +assert.sameValue('\118', '\x098', '\\118'); +assert.sameValue('\168', '\x0e8', '\\168'); +assert.sameValue('\178', '\x0f8', '\\178'); +assert.sameValue('\208', '\x108', '\\208'); +assert.sameValue('\218', '\x118', '\\218'); +assert.sameValue('\268', '\x168', '\\268'); +assert.sameValue('\278', '\x178', '\\278'); +assert.sameValue('\308', '\x188', '\\308'); +assert.sameValue('\318', '\x198', '\\318'); +assert.sameValue('\368', '\x1e8', '\\368'); +assert.sameValue('\378', '\x1f8', '\\378'); + +// LegacyOctalEscapeSequence :: +// FourToSeven OctalDigit +assert.sameValue('\40', '\x20', '\\40'); +assert.sameValue('\41', '\x21', '\\41'); +assert.sameValue('\46', '\x26', '\\46'); +assert.sameValue('\47', '\x27', '\\47'); +assert.sameValue('\50', '\x28', '\\50'); +assert.sameValue('\51', '\x29', '\\51'); +assert.sameValue('\56', '\x2e', '\\56'); +assert.sameValue('\57', '\x2f', '\\57'); +assert.sameValue('\60', '\x30', '\\60'); +assert.sameValue('\61', '\x31', '\\61'); +assert.sameValue('\66', '\x36', '\\66'); +assert.sameValue('\67', '\x37', '\\67'); +assert.sameValue('\70', '\x38', '\\70'); +assert.sameValue('\71', '\x39', '\\71'); +assert.sameValue('\76', '\x3e', '\\76'); +assert.sameValue('\77', '\x3f', '\\77'); +assert.sameValue('\400', '\x200', '\\400'); +assert.sameValue('\410', '\x210', '\\410'); +assert.sameValue('\460', '\x260', '\\460'); +assert.sameValue('\470', '\x270', '\\470'); +assert.sameValue('\500', '\x280', '\\500'); +assert.sameValue('\510', '\x290', '\\510'); +assert.sameValue('\560', '\x2e0', '\\560'); +assert.sameValue('\570', '\x2f0', '\\570'); +assert.sameValue('\600', '\x300', '\\600'); +assert.sameValue('\610', '\x310', '\\610'); +assert.sameValue('\660', '\x360', '\\660'); +assert.sameValue('\670', '\x370', '\\670'); +assert.sameValue('\700', '\x380', '\\700'); +assert.sameValue('\710', '\x390', '\\710'); +assert.sameValue('\760', '\x3e0', '\\760'); +assert.sameValue('\770', '\x3f0', '\\770'); + +// LegacyOctalEscapeSequence :: +// ZeroToThree OctalDigit OctalDigit +assert.sameValue('\000', '\x00', '\\000'); +assert.sameValue('\001', '\x01', '\\001'); +assert.sameValue('\010', '\x08', '\\010'); +assert.sameValue('\006', '\x06', '\\006'); +assert.sameValue('\060', '\x30', '\\060'); +assert.sameValue('\007', '\x07', '\\007'); +assert.sameValue('\070', '\x38', '\\070'); +assert.sameValue('\077', '\x3f', '\\077'); +assert.sameValue('\100', '\x40', '\\100'); +assert.sameValue('\101', '\x41', '\\101'); +assert.sameValue('\110', '\x48', '\\110'); +assert.sameValue('\106', '\x46', '\\106'); +assert.sameValue('\160', '\x70', '\\160'); +assert.sameValue('\107', '\x47', '\\107'); +assert.sameValue('\170', '\x78', '\\170'); +assert.sameValue('\177', '\x7f', '\\177'); +assert.sameValue('\200', '\x80', '\\200'); +assert.sameValue('\201', '\x81', '\\201'); +assert.sameValue('\210', '\x88', '\\210'); +assert.sameValue('\206', '\x86', '\\206'); +assert.sameValue('\260', '\xb0', '\\260'); +assert.sameValue('\207', '\x87', '\\207'); +assert.sameValue('\270', '\xb8', '\\270'); +assert.sameValue('\277', '\xbf', '\\277'); +assert.sameValue('\300', '\xc0', '\\300'); +assert.sameValue('\301', '\xc1', '\\301'); +assert.sameValue('\310', '\xc8', '\\310'); +assert.sameValue('\306', '\xc6', '\\306'); +assert.sameValue('\360', '\xf0', '\\360'); +assert.sameValue('\307', '\xc7', '\\307'); +assert.sameValue('\370', '\xf8', '\\370'); +assert.sameValue('\377', '\xff', '\\377'); + +reportCompare(0, 0); 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' |