diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/comments | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/comments')
56 files changed, 1185 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/comments/S7.4_A1_T1.js b/js/src/tests/test262/language/comments/S7.4_A1_T1.js new file mode 100644 index 0000000000..53e7af07f0 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A1_T1.js @@ -0,0 +1,36 @@ +// 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 single line comments +es5id: 7.4_A1_T1 +description: Create comments with any code +---*/ + +//CHECK#1 +// Test262Error.thrower('#1: Correct interpretation single line comments'); + +//CHECK#2 +var x = 0; +assert.sameValue(x, 0, 'The value of `x` is 0'); + +//CHECK#3 +var // y = 1; +y; +assert.sameValue(y, undefined, 'The value of `y` is expected to equal `undefined`'); + +//CHECK#4 +//Test262Error.thrower('#4: Correct interpretation single line comments') //Test262Error.thrower('#4: Correct interpretation single line comments'); // + +////CHECK#5 +//var x = 1; +//if (x === 1) { +// Test262Error.thrower('#5: Correct interpretation single line comments'); +//} + +//CHECK#6 +//var this.y = 1; +this.y++; +assert.sameValue(isNaN(y), true, 'isNaN(y) returns true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A1_T2.js b/js/src/tests/test262/language/comments/S7.4_A1_T2.js new file mode 100644 index 0000000000..89a71fa68a --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A1_T2.js @@ -0,0 +1,13 @@ +// 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 single line comments +es5id: 7.4_A1_T2 +description: "Simple test, create empty comment: ///" +---*/ + +//CHECK#1 +/// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A2_T1.js b/js/src/tests/test262/language/comments/S7.4_A2_T1.js new file mode 100644 index 0000000000..123041c021 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A2_T1.js @@ -0,0 +1,65 @@ +// 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 multi line comments +es5id: 7.4_A2_T1 +description: Create comments with any code +---*/ + +/*CHECK#1*/ +/* Test262Error.thrower('#1: Correct interpretation multi line comments'); +*/ + +/*CHECK#2*/ +var x = 0; +/* x = 1;*/ +assert.sameValue(x, 0, 'The value of `x` is 0'); + +//CHECK#3 +var /* y = 1;*/ +y; +assert.sameValue(y, undefined, 'The value of `y` is expected to equal `undefined`'); + +//CHECK#4 +var /* y = 1;*/ y; +assert.sameValue(y, undefined, 'The value of `y` is expected to equal `undefined`'); + +/*CHECK#5*/ +/*var x = 1; +if (x === 1) { + Test262Error.thrower('#5: Correct interpretation multi line comments'); +} +*/ + +/*CHECK#6*/ +/*var this.y = 1;*/ +this.y++; +assert.sameValue(isNaN(y), true, 'isNaN(y) returns true'); + +//CHECK#7 +var string = "/*var y = 0*/" /* y = 1;*/ +assert.sameValue(string, "/*var y = 0*/", 'The value of `string` is "/*var y = 0*/"'); + +//CHECK#8 +var string = "/*var y = 0" /* y = 1;*/ +assert.sameValue(string, "/*var y = 0", 'The value of `string` is "/*var y = 0"'); + +/*CHECK#9*/ +/** Test262Error.thrower('#9: Correct interpretation multi line comments'); +*/ + +/*CHECK#10*/ +/* Test262Error.thrower('#10: Correct interpretation multi line comments'); +**/ + +/*CHECK#11*/ +/****** Test262Error.thrower('#11: Correct interpretation multi line comments');********* +*********** +* + + +********** +**/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A2_T2.js b/js/src/tests/test262/language/comments/S7.4_A2_T2.js new file mode 100644 index 0000000000..9367631d47 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A2_T2.js @@ -0,0 +1,16 @@ +// |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: Correct interpretation of multi line comments +es5id: 7.4_A2_T2 +description: Try use /*CHECK#1/. This is not closed multi line comment +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/*CHECK#1/ diff --git a/js/src/tests/test262/language/comments/S7.4_A3.js b/js/src/tests/test262/language/comments/S7.4_A3.js new file mode 100644 index 0000000000..1022d4e378 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A3.js @@ -0,0 +1,23 @@ +// |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: Multi line comments cannot nest +es5id: 7.4_A3 +description: Try use nested comments +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/*CHECK#1*/ + +/* +var + +/* x */ += 1; +*/ diff --git a/js/src/tests/test262/language/comments/S7.4_A4_T1.js b/js/src/tests/test262/language/comments/S7.4_A4_T1.js new file mode 100644 index 0000000000..d7c5f9c404 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A4_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: Single and Multi line comments are used together +es5id: 7.4_A4_T1 +description: Try use 2 close comment tags +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/*CHECK#1*/ + +/* var*/ +x*/ diff --git a/js/src/tests/test262/language/comments/S7.4_A4_T2.js b/js/src/tests/test262/language/comments/S7.4_A4_T2.js new file mode 100644 index 0000000000..40eab2bd54 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A4_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: Single and Multi line comments are used together +es5id: 7.4_A4_T2 +description: Fist Multi line comment, then Single line comment +---*/ + +/*CHECK#1*/ + +/* var +*///x*/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A4_T3.js b/js/src/tests/test262/language/comments/S7.4_A4_T3.js new file mode 100644 index 0000000000..d11197915b --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A4_T3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Single and Multi line comments are used together +es5id: 7.4_A4_T3 +description: Insert Single line comment into Multi line comment +---*/ + +/*CHECK#1*/ + +/* var +//x +*/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A4_T4.js b/js/src/tests/test262/language/comments/S7.4_A4_T4.js new file mode 100644 index 0000000000..4c767e1678 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A4_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: Single and Multi line comments are used together +es5id: 7.4_A4_T4 +description: Try to open Multi line comment at the end of Single comment +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/*CHECK#1*/ + +// var /* +x*/ diff --git a/js/src/tests/test262/language/comments/S7.4_A4_T5.js b/js/src/tests/test262/language/comments/S7.4_A4_T5.js new file mode 100644 index 0000000000..0e826c180e --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A4_T5.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Single and Multi line comments are used together +es5id: 7.4_A4_T5 +description: Insert Multi line comment into Single line comment +---*/ + +/*CHECK#1*/ + +// var /* x */ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A4_T6.js b/js/src/tests/test262/language/comments/S7.4_A4_T6.js new file mode 100644 index 0000000000..cb76b864ee --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A4_T6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Single and Multi line comments are used together +es5id: 7.4_A4_T6 +description: > + Insert Multi line comment with two closed tags into Single line + comment +---*/ + +/*CHECK#1*/ + +// var /* x / = */ 1 */ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A4_T7.js b/js/src/tests/test262/language/comments/S7.4_A4_T7.js new file mode 100644 index 0000000000..cec333a3ae --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A4_T7.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Single and Multi line comments are used together +es5id: 7.4_A4_T7 +description: Insert Multi line comment into Single line comments +---*/ + +/*CHECK#1*/ + +// var /* +// x +// = +// 1*/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A5.js b/js/src/tests/test262/language/comments/S7.4_A5.js new file mode 100644 index 0000000000..933e8e4db8 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A5.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Single line comments can contain any Unicode character without Line + Terminators +es5id: 7.4_A5 +description: > + //var " + xx + "yy = -1", insert instead of xx all Unicode + characters +---*/ + +var hex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]; +for (var i1 = 0; i1 < 16; i1++) { + for (var i2 = 0; i2 < 16; i2++) { + for (var i3 = 0; i3 < 16; i3++) { + for (var i4 = 0; i4 < 16; i4++) { + try { + var uu = hex[i1] + hex[i2] + hex[i3] + hex[i4]; + var xx = String.fromCharCode("0x" + uu); + var LineTerminators = ((uu === "000A") || (uu === "000D") || (uu === "2028") || (uu === "2029")); + var yy = 0; + eval("//var " + xx + "yy = -1"); + if (LineTerminators !== true) { + if (yy !== 0) { + throw new Test262Error('#' + uu + ' '); + } + } else { + if (yy !== -1) { + throw new Test262Error('#' + uu + ' '); + } + } + } catch (e){ + throw new Test262Error('#' + uu + ' '); + } + } + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/S7.4_A6.js b/js/src/tests/test262/language/comments/S7.4_A6.js new file mode 100644 index 0000000000..e91a6f5710 --- /dev/null +++ b/js/src/tests/test262/language/comments/S7.4_A6.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If multi line comments csn not nest, they can contain any Unicode + character +es5id: 7.4_A6 +description: "\"var\"+ yy+ \"xx = 1\", insert instead of yy all Unicode characters" +includes: [decimalToHexString.js] +---*/ + +for (var indexI = 0; indexI <= 65535; indexI++) { + try { + var xx = 0; + eval("/*var " + String.fromCharCode(indexI) + "xx = 1*/"); + var differs = xx !== 0; + } catch (e){ + throw new Test262Error('#' + decimalToHexString(indexI) + ' throws'); + } + if (differs) { + throw new Test262Error('#' + decimalToHexString(indexI) + ' differs'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/browser.js b/js/src/tests/test262/language/comments/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/comments/browser.js diff --git a/js/src/tests/test262/language/comments/hashbang/browser.js b/js/src/tests/test262/language/comments/hashbang/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/browser.js diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-bang-041.js b/js/src/tests/test262/language/comments/hashbang/escaped-bang-041.js new file mode 100644 index 0000000000..c232decb83 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-bang-041.js @@ -0,0 +1,20 @@ +#\041 + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \041 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-bang-u0021.js b/js/src/tests/test262/language/comments/hashbang/escaped-bang-u0021.js new file mode 100644 index 0000000000..52b012bff0 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-bang-u0021.js @@ -0,0 +1,20 @@ +#\u0021 + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \u0021 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-bang-u21.js b/js/src/tests/test262/language/comments/hashbang/escaped-bang-u21.js new file mode 100644 index 0000000000..75f7e4d5af --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-bang-u21.js @@ -0,0 +1,20 @@ +#\u{21} + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \u{21} +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-bang-x21.js b/js/src/tests/test262/language/comments/hashbang/escaped-bang-x21.js new file mode 100644 index 0000000000..f6233833da --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-bang-x21.js @@ -0,0 +1,20 @@ +#\x21 + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \x21 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hash-043.js b/js/src/tests/test262/language/comments/hashbang/escaped-hash-043.js new file mode 100644 index 0000000000..0c9e27d0b6 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-hash-043.js @@ -0,0 +1,20 @@ +\043! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \043 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hash-u0023.js b/js/src/tests/test262/language/comments/hashbang/escaped-hash-u0023.js new file mode 100644 index 0000000000..2cb370a63e --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-hash-u0023.js @@ -0,0 +1,20 @@ +\u0023! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \u0023 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hash-u23.js b/js/src/tests/test262/language/comments/hashbang/escaped-hash-u23.js new file mode 100644 index 0000000000..96859b568b --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-hash-u23.js @@ -0,0 +1,20 @@ +\u{23}! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \u{23} +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hash-x23.js b/js/src/tests/test262/language/comments/hashbang/escaped-hash-x23.js new file mode 100644 index 0000000000..82ae6c48c2 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-hash-x23.js @@ -0,0 +1,20 @@ +\x23! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters \x23 +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/escaped-hashbang.js b/js/src/tests/test262/language/comments/hashbang/escaped-hashbang.js new file mode 100644 index 0000000000..9cfe30afce --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/escaped-hashbang.js @@ -0,0 +1,20 @@ +\u0023\u0021 + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed to have encoded characters +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/eval-indirect.js b/js/src/tests/test262/language/comments/hashbang/eval-indirect.js new file mode 100644 index 0000000000..2e43a6fd59 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/eval-indirect.js @@ -0,0 +1,18 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should be available in Script evaluator contexts. (indirect eval) +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +features: [hashbang] +---*/ + +assert.sameValue((0, eval)('#!\n'), undefined); +assert.sameValue((0, eval)('#!\n1'), 1) +assert.sameValue((0, eval)('#!2\n'), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/eval.js b/js/src/tests/test262/language/comments/hashbang/eval.js new file mode 100644 index 0000000000..3d2cc6603a --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/eval.js @@ -0,0 +1,18 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should be available in Script evaluator contexts. (direct eval) +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +features: [hashbang] +---*/ + +assert.sameValue(eval('#!\n'), undefined); +assert.sameValue(eval('#!\n1'), 1) +assert.sameValue(eval('#!2\n'), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/function-body.js b/js/src/tests/test262/language/comments/hashbang/function-body.js new file mode 100644 index 0000000000..1e2f5f9f63 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/function-body.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be allowed within function bodies. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +$DONOTEVALUATE(); + +function fn() {#! +} diff --git a/js/src/tests/test262/language/comments/hashbang/function-constructor.js b/js/src/tests/test262/language/comments/hashbang/function-constructor.js new file mode 100644 index 0000000000..cc75e78e47 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/function-constructor.js @@ -0,0 +1,29 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be allowed in function evaluator contexts. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +features: [hashbang] +---*/ + +const AsyncFunction = (async function (){}).constructor; +const GeneratorFunction = (function *(){}).constructor; +const AsyncGeneratorFunction = (async function *(){}).constructor; +for (const ctor of [ + Function, + AsyncFunction, + GeneratorFunction, + AsyncGeneratorFunction, +]) { + assert.throws(SyntaxError, () => ctor('#!\n_', ''), `${ctor.name} Call argument`); + assert.throws(SyntaxError, () => ctor('#!\n_'), `${ctor.name} Call body`); + assert.throws(SyntaxError, () => new ctor('#!\n_', ''), `${ctor.name} Construct argument`); + assert.throws(SyntaxError, () => new ctor('#!\n_'), `${ctor.name} Construct body`); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/line-terminator-carriage-return.js b/js/src/tests/test262/language/comments/hashbang/line-terminator-carriage-return.js new file mode 100644 index 0000000000..56d66b15d2 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/line-terminator-carriage-return.js @@ -0,0 +1,30 @@ +#! this comment ends with a Carriage Return (U+000D)
{ +} + +// Copyright (C) 2019 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments are terminated by the first LineTerminator: Carriage Return +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] + + SingleLineCommentChars:: + SingleLineCommentChar SingleLineCommentChars[opt] + + SingleLineCommentChar:: + SourceCharacter but not LineTerminator + + LineTerminator:: + <LF> + <CR> + <LS> + <PS> +flags: [raw] +features: [hashbang] +---*/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/line-terminator-line-separator.js b/js/src/tests/test262/language/comments/hashbang/line-terminator-line-separator.js new file mode 100644 index 0000000000..62829d0f3e --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/line-terminator-line-separator.js @@ -0,0 +1,30 @@ +#! this comment ends with a Line Separator (U+2028)
{ +} + +// Copyright (C) 2019 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments are terminated by the first LineTerminator: Line Separator +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] + + SingleLineCommentChars:: + SingleLineCommentChar SingleLineCommentChars[opt] + + SingleLineCommentChar:: + SourceCharacter but not LineTerminator + + LineTerminator:: + <LF> + <CR> + <LS> + <PS> +flags: [raw] +features: [hashbang] +---*/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/line-terminator-paragraph-separator.js b/js/src/tests/test262/language/comments/hashbang/line-terminator-paragraph-separator.js new file mode 100644 index 0000000000..1b6e906046 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/line-terminator-paragraph-separator.js @@ -0,0 +1,30 @@ +#! this comment ends with a Paragraph Separator (U+2029)
{ +} + +// Copyright (C) 2019 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments are terminated by the first LineTerminator: Paragraph Separator +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] + + SingleLineCommentChars:: + SingleLineCommentChar SingleLineCommentChars[opt] + + SingleLineCommentChar:: + SourceCharacter but not LineTerminator + + LineTerminator:: + <LF> + <CR> + <LS> + <PS> +flags: [raw] +features: [hashbang] +---*/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/module.js b/js/src/tests/test262/language/comments/hashbang/module.js new file mode 100644 index 0000000000..d789ef11d4 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/module.js @@ -0,0 +1,17 @@ +#! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should be allowed in Modules. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [module, raw] +features: [hashbang] +---*/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/multi-line-comment.js b/js/src/tests/test262/language/comments/hashbang/multi-line-comment.js new file mode 100644 index 0000000000..c6956b334e --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/multi-line-comment.js @@ -0,0 +1,21 @@ +#!/* +throw "Test262: This statement should not be evaluated."; +these characters should not be considered within a comment +*/ + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not interpret multi-line comments. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ diff --git a/js/src/tests/test262/language/comments/hashbang/no-line-separator.js b/js/src/tests/test262/language/comments/hashbang/no-line-separator.js new file mode 100644 index 0000000000..6e9c422f61 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/no-line-separator.js @@ -0,0 +1,16 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not require a newline afterwards +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +features: [hashbang] +---*/ + +assert.sameValue(eval('#!'), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/not-empty.js b/js/src/tests/test262/language/comments/hashbang/not-empty.js new file mode 100644 index 0000000000..0be0d4bf1a --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/not-empty.js @@ -0,0 +1,17 @@ +#! these characters should be treated as a comment + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should be allowed in Scripts and should not be required to be empty. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +features: [hashbang] +---*/ + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue-sc.js b/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue-sc.js new file mode 100644 index 0000000000..bc010e7212 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue-sc.js @@ -0,0 +1,21 @@ +"use strict"; +#! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at start of source texts and should not be preceded by DirectivePrologues. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue.js b/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue.js new file mode 100644 index 0000000000..42cae8422c --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/preceding-directive-prologue.js @@ -0,0 +1,21 @@ +"use strict" +#! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at start of source texts and should not be preceded by DirectivePrologues. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-empty-statement.js b/js/src/tests/test262/language/comments/hashbang/preceding-empty-statement.js new file mode 100644 index 0000000000..7a66922372 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/preceding-empty-statement.js @@ -0,0 +1,20 @@ +;#! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by empty statements. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-hashbang.js b/js/src/tests/test262/language/comments/hashbang/preceding-hashbang.js new file mode 100644 index 0000000000..166457f37c --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/preceding-hashbang.js @@ -0,0 +1,21 @@ +#! +#! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by Hashbang comments. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-line-comment.js b/js/src/tests/test262/language/comments/hashbang/preceding-line-comment.js new file mode 100644 index 0000000000..f30e609487 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/preceding-line-comment.js @@ -0,0 +1,21 @@ +// +#! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by line comments. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-multi-line-comment.js b/js/src/tests/test262/language/comments/hashbang/preceding-multi-line-comment.js new file mode 100644 index 0000000000..f582e29996 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/preceding-multi-line-comment.js @@ -0,0 +1,21 @@ +/* +*/#! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by multi-line comments. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/preceding-whitespace.js b/js/src/tests/test262/language/comments/hashbang/preceding-whitespace.js new file mode 100644 index 0000000000..03afd1b872 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/preceding-whitespace.js @@ -0,0 +1,20 @@ + #! + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be preceded by whitespace. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +throw "Test262: This statement should not be evaluated."; diff --git a/js/src/tests/test262/language/comments/hashbang/shell.js b/js/src/tests/test262/language/comments/hashbang/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/shell.js diff --git a/js/src/tests/test262/language/comments/hashbang/statement-block.js b/js/src/tests/test262/language/comments/hashbang/statement-block.js new file mode 100644 index 0000000000..3d322fc700 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/statement-block.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should only be allowed at the start of source texts and should not be allowed within blocks. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +negative: + phase: parse + type: SyntaxError +features: [hashbang] +---*/ + +$DONOTEVALUATE(); + +{ + #! +} diff --git a/js/src/tests/test262/language/comments/hashbang/use-strict.js b/js/src/tests/test262/language/comments/hashbang/use-strict.js new file mode 100644 index 0000000000..7c86b066a0 --- /dev/null +++ b/js/src/tests/test262/language/comments/hashbang/use-strict.js @@ -0,0 +1,19 @@ +#!"use strict" + +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + Hashbang comments should not be interpreted and should not generate DirectivePrologues. +info: | + HashbangComment:: + #! SingleLineCommentChars[opt] +flags: [raw] +features: [hashbang] +---*/ + +with ({}) {} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/mongolian-vowel-separator-multi.js b/js/src/tests/test262/language/comments/mongolian-vowel-separator-multi.js new file mode 100644 index 0000000000..7c2ba00efa --- /dev/null +++ b/js/src/tests/test262/language/comments/mongolian-vowel-separator-multi.js @@ -0,0 +1,28 @@ +// 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 multi-line comments. +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 comments; UTF8(0x180E) = 0xE1 0xA0 0x8E +assert.sameValue( + 0, /* multi-line comment with U+180E */ + 0 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/mongolian-vowel-separator-single-eval.js b/js/src/tests/test262/language/comments/mongolian-vowel-separator-single-eval.js new file mode 100644 index 0000000000..e51d44fd6f --- /dev/null +++ b/js/src/tests/test262/language/comments/mongolian-vowel-separator-single-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 single-line comments (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("0 //\u180E"), 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/mongolian-vowel-separator-single.js b/js/src/tests/test262/language/comments/mongolian-vowel-separator-single.js new file mode 100644 index 0000000000..d367c5846a --- /dev/null +++ b/js/src/tests/test262/language/comments/mongolian-vowel-separator-single.js @@ -0,0 +1,28 @@ +// 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 single-line comments. +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 comments; UTF8(0x180E) = 0xE1 0xA0 0x8E +assert.sameValue( + 0, // single-line comment with U+180E + 0 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/multi-line-asi-carriage-return.js b/js/src/tests/test262/language/comments/multi-line-asi-carriage-return.js new file mode 100644 index 0000000000..b8d35fa410 --- /dev/null +++ b/js/src/tests/test262/language/comments/multi-line-asi-carriage-return.js @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.4 +esid: sec-comments +description: > + A multi-line comment containing a carriage return should be considered a + LineTerminator +info: > + Comments behave like white space and are discarded except that, if a + MultiLineComment contains a line terminator code point, then the entire + comment is considered to be a LineTerminator for purposes of parsing by the + syntactic grammar. +---*/ + +''/*
*/'' + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/multi-line-asi-line-feed.js b/js/src/tests/test262/language/comments/multi-line-asi-line-feed.js new file mode 100644 index 0000000000..af99e055a4 --- /dev/null +++ b/js/src/tests/test262/language/comments/multi-line-asi-line-feed.js @@ -0,0 +1,20 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.4 +esid: sec-comments +description: > + A multi-line comment containing a line feed should be considered a + LineTerminator +info: > + Comments behave like white space and are discarded except that, if a + MultiLineComment contains a line terminator code point, then the entire + comment is considered to be a LineTerminator for purposes of parsing by the + syntactic grammar. +---*/ + +''/* +*/'' + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/multi-line-asi-line-separator.js b/js/src/tests/test262/language/comments/multi-line-asi-line-separator.js new file mode 100644 index 0000000000..b4f9e98051 --- /dev/null +++ b/js/src/tests/test262/language/comments/multi-line-asi-line-separator.js @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.4 +esid: sec-comments +description: > + A multi-line comment containing a line separator should be considered a + LineTerminator +info: > + Comments behave like white space and are discarded except that, if a + MultiLineComment contains a line terminator code point, then the entire + comment is considered to be a LineTerminator for purposes of parsing by the + syntactic grammar. +---*/ + +''/*
*/'' + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/multi-line-asi-paragraph-separator.js b/js/src/tests/test262/language/comments/multi-line-asi-paragraph-separator.js new file mode 100644 index 0000000000..104a1beb51 --- /dev/null +++ b/js/src/tests/test262/language/comments/multi-line-asi-paragraph-separator.js @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 7.4 +esid: sec-comments +description: > + A multi-line comment containing a paragrah separator should be considered a + LineTerminator +info: > + Comments behave like white space and are discarded except that, if a + MultiLineComment contains a line terminator code point, then the entire + comment is considered to be a LineTerminator for purposes of parsing by the + syntactic grammar. +---*/ + +''/*
*/'' + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/comments/multi-line-html-close-extra.js b/js/src/tests/test262/language/comments/multi-line-html-close-extra.js new file mode 100644 index 0000000000..c31542da2b --- /dev/null +++ b/js/src/tests/test262/language/comments/multi-line-html-close-extra.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// 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-html-like-comments +description: > + Arbitrary character sequence not permitted before HTMLCloseComment token +info: | + Comment :: + MultiLineComment + SingleLineComment + SingleLineHTMLOpenComment + SingleLineHTMLCloseComment + SingleLineDelimitedComment + + MultiLineComment :: + /* FirstCommentLine[opt] LineTerminator MultiLineCommentChars[opt] * / HTMLCloseComment[opt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +/* +*/ the comment should not include these characters, regardless of AnnexB extensions --> diff --git a/js/src/tests/test262/language/comments/shell.js b/js/src/tests/test262/language/comments/shell.js new file mode 100644 index 0000000000..a8ffe3a680 --- /dev/null +++ b/js/src/tests/test262/language/comments/shell.js @@ -0,0 +1,28 @@ +// GENERATED, DO NOT EDIT +// file: decimalToHexString.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + Collection of functions used to assert the correctness of various encoding operations. +defines: [decimalToHexString, decimalToPercentHexString] +---*/ + +function decimalToHexString(n) { + var hex = "0123456789ABCDEF"; + n >>>= 0; + var s = ""; + while (n) { + s = hex[n & 0xf] + s; + n >>>= 4; + } + while (s.length < 4) { + s = "0" + s; + } + return s; +} + +function decimalToPercentHexString(n) { + var hex = "0123456789ABCDEF"; + return "%" + hex[(n >> 4) & 0xf] + hex[n & 0xf]; +} diff --git a/js/src/tests/test262/language/comments/single-line-html-close-without-lt.js b/js/src/tests/test262/language/comments/single-line-html-close-without-lt.js new file mode 100644 index 0000000000..f8accff32e --- /dev/null +++ b/js/src/tests/test262/language/comments/single-line-html-close-without-lt.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// 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-html-like-comments +description: An HTMLCloseComment must be preceded by a LineTerminator +info: | + Comment :: + MultiLineComment + SingleLineComment + SingleLineHTMLOpenComment + SingleLineHTMLCloseComment + SingleLineDelimitedComment + + HTMLCloseComment :: + WhiteSpaceSequence[opt] SingleLineDelimitedCommentSequence[opt] --> SingleLineCommentChars[opt] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +;--> |