diff options
Diffstat (limited to 'js/src/tests/test262/ch07/7.4')
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A1_T1.js | 44 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A1_T2.js | 13 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A2_T1.js | 78 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A2_T2.js | 13 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A3.js | 20 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A4_T1.js | 16 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A4_T2.js | 15 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A4_T3.js | 16 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A4_T4.js | 16 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A4_T5.js | 14 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A4_T6.js | 14 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A4_T7.js | 17 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A5.js | 49 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/S7.4_A6.js | 57 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/test262/ch07/7.4/shell.js | 0 |
16 files changed, 382 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A1_T1.js b/js/src/tests/test262/ch07/7.4/S7.4_A1_T1.js new file mode 100644 index 000000000..87bb8ce1a --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A1_T1.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Correct interpretation of single line comments + * + * @path ch07/7.4/S7.4_A1_T1.js + * @description Create comments with any code + */ + +//CHECK#1 +// $ERROR('#1: Correct interpretation single line comments'); + +//CHECK#2 +var x = 0; +// x = 1; +if (x !== 0) { + $ERROR('#2: var x = 0; // x = 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +var // y = 1; +y; +if (y !== undefined) { + $ERROR('#3: var // y = 1; \\n y; y === undefined. Actual: ' + (y)); +} + +//CHECK#4 +//$ERROR('#4: Correct interpretation single line comments') //$ERROR('#4: Correct interpretation single line comments'); // + +////CHECK#5 +//var x = 1; +//if (x === 1) { +// $ERROR('#5: Correct interpretation single line comments'); +//} + +//CHECK#6 +//var this.y = 1; +this.y++; +if (isNaN(y) !== true) { + $ERROR('#6: //var this.y = 1; \\n this.y++; y === Not-a-Number. Actual: ' + (y)); +} + + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A1_T2.js b/js/src/tests/test262/ch07/7.4/S7.4_A1_T2.js new file mode 100644 index 000000000..4d8d8af43 --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/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. + +/** + * Correct interpretation of single line comments + * + * @path ch07/7.4/S7.4_A1_T2.js + * @description Simple test, create empty comment: /// + */ + +//CHECK#1 +/// + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A2_T1.js b/js/src/tests/test262/ch07/7.4/S7.4_A2_T1.js new file mode 100644 index 000000000..97b8e6268 --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A2_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Correct interpretation of multi line comments + * + * @path ch07/7.4/S7.4_A2_T1.js + * @description Create comments with any code + */ + +/*CHECK#1*/ +/* $ERROR('#1: Correct interpretation multi line comments'); +*/ + +/*CHECK#2*/ +var x = 0; +/* x = 1;*/ +if (x !== 0) { + $ERROR('#2: var x = 0; /* x = 1;*/ x === 0. Actual: ' + (x)); +} + +//CHECK#3 +var /* y = 1;*/ +y; +if (y !== undefined) { + $ERROR('#3: var /* y = 1; */ \\n y; y === undefined. Actual: ' + (y)); +} + +//CHECK#4 +var /* y = 1;*/ y; +if (y !== undefined) { + $ERROR('#4: var /* y = 1; */ y; y === undefined. Actual: ' + (y)); +} + +/*CHECK#5*/ +/*var x = 1; +if (x === 1) { + $ERROR('#5: Correct interpretation multi line comments'); +} +*/ + +/*CHECK#6*/ +/*var this.y = 1;*/ +this.y++; +if (isNaN(y) !== true) { + $ERROR('#6: /*var this.y = 1;*/ \\n this.y++; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#7 +var string = "/*var y = 0*/" /* y = 1;*/ +if (string !== "/*var y = 0*/") { +$ERROR('#7: var string = "/*var y = 0*/" /* y = 1;*/ string === "//var y = 0"'); +} + +//CHECK#8 +var string = "/*var y = 0" /* y = 1;*/ +if (string !== "/*var y = 0") { +$ERROR('#8: var string = "/*var y = 0" /* y = 1;*/ string === "//var y = 0"'); +} + +/*CHECK#9*/ +/** $ERROR('#9: Correct interpretation multi line comments'); +*/ + +/*CHECK#10*/ +/* $ERROR('#10: Correct interpretation multi line comments'); +**/ + +/*CHECK#11*/ +/****** $ERROR('#11: Correct interpretation multi line comments');********* +*********** +* + + +********** +**/ + + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A2_T2.js b/js/src/tests/test262/ch07/7.4/S7.4_A2_T2.js new file mode 100644 index 000000000..feb4c9c2b --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A2_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. + +/** + * Correct interpretation of multi line comments + * + * @path ch07/7.4/S7.4_A2_T2.js + * @description Try use /*CHECK#1/. This is not closed multi line comment + * @negative + */ + +/*CHECK#1/ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A3.js b/js/src/tests/test262/ch07/7.4/S7.4_A3.js new file mode 100644 index 000000000..2efc9fab1 --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Multi line comments cannot nest + * + * @path ch07/7.4/S7.4_A3.js + * @description Try use nested comments + * @negative + */ + +/*CHECK#1*/ + +/* +var + +/* x */ += 1; +*/ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A4_T1.js b/js/src/tests/test262/ch07/7.4/S7.4_A4_T1.js new file mode 100644 index 000000000..87c6ace88 --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A4_T1.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. + +/** + * Single and Multi line comments are used together + * + * @path ch07/7.4/S7.4_A4_T1.js + * @description Try use 2 close comment tags + * @negative + */ + +/*CHECK#1*/ + +/* var*/ +x*/ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A4_T2.js b/js/src/tests/test262/ch07/7.4/S7.4_A4_T2.js new file mode 100644 index 000000000..b64b28e0e --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/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. + +/** + * Single and Multi line comments are used together + * + * @path ch07/7.4/S7.4_A4_T2.js + * @description Fist Multi line comment, then Single line comment + */ + +/*CHECK#1*/ + +/* var +*///x*/ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A4_T3.js b/js/src/tests/test262/ch07/7.4/S7.4_A4_T3.js new file mode 100644 index 000000000..3e39f693a --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/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. + +/** + * Single and Multi line comments are used together + * + * @path ch07/7.4/S7.4_A4_T3.js + * @description Insert Single line comment into Multi line comment + */ + +/*CHECK#1*/ + +/* var +//x +*/ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A4_T4.js b/js/src/tests/test262/ch07/7.4/S7.4_A4_T4.js new file mode 100644 index 000000000..1b5657663 --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A4_T4.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. + +/** + * Single and Multi line comments are used together + * + * @path ch07/7.4/S7.4_A4_T4.js + * @description Try to open Multi line comment at the end of Single comment + * @negative + */ + +/*CHECK#1*/ + +// var /* +x*/ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A4_T5.js b/js/src/tests/test262/ch07/7.4/S7.4_A4_T5.js new file mode 100644 index 000000000..9a01060ee --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/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. + +/** + * Single and Multi line comments are used together + * + * @path ch07/7.4/S7.4_A4_T5.js + * @description Insert Multi line comment into Single line comment + */ + +/*CHECK#1*/ + +// var /* x */ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A4_T6.js b/js/src/tests/test262/ch07/7.4/S7.4_A4_T6.js new file mode 100644 index 000000000..08c983d7b --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A4_T6.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. + +/** + * Single and Multi line comments are used together + * + * @path ch07/7.4/S7.4_A4_T6.js + * @description Insert Multi line comment with two closed tags into Single line comment + */ + +/*CHECK#1*/ + +// var /* x / = */ 1 */ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A4_T7.js b/js/src/tests/test262/ch07/7.4/S7.4_A4_T7.js new file mode 100644 index 000000000..a58aa7d5d --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/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. + +/** + * Single and Multi line comments are used together + * + * @path ch07/7.4/S7.4_A4_T7.js + * @description Insert Multi line comment into Single line comments + */ + +/*CHECK#1*/ + +// var /* +// x +// = +// 1*/ + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A5.js b/js/src/tests/test262/ch07/7.4/S7.4_A5.js new file mode 100644 index 000000000..bbdba29de --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A5.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Single line comments can contain any Unicode character without Line Terminators + * + * @path ch07/7.4/S7.4_A5.js + * @description //var " + xx + "yy = -1", insert instead of xx all Unicode characters + */ + +//CHECK +var errorCount = 0; +var count = 0; +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) { + $ERROR('#' + uu + ' '); + errorCount++; + } + } else { + if (yy !== -1) { + $ERROR('#' + uu + ' '); + errorCount++; + } + } + } catch (e){ + $ERROR('#' + uu + ' '); + errorCount++; + } + count++; + } + } + } +} + +if (errorCount > 0) { + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count); +} + diff --git a/js/src/tests/test262/ch07/7.4/S7.4_A6.js b/js/src/tests/test262/ch07/7.4/S7.4_A6.js new file mode 100644 index 000000000..c51790aeb --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/S7.4_A6.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If multi line comments csn not nest, they can contain any Unicode character + * + * @path ch07/7.4/S7.4_A6.js + * @description "var"+ yy+ "xx = 1", insert instead of yy all Unicode characters + */ + +//CHECK +var errorCount = 0; +var count = 0; +for (var indexI = 0; indexI <= 65535; indexI++) { + try { + var xx = 0; + eval("/*var " + String.fromCharCode(indexI) + "xx = 1*/"); + var hex = decimalToHexString(indexI); + if (xx !== 0) { + $ERROR('#' + hex + ' '); + errorCount++; + } + } catch (e){ + $ERROR('#' + hex + ' '); + errorCount++; + } + count++; +} + +if (errorCount > 0) { + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count); +} + +function decimalToHexString(n) { + n = Number(n); + var h = ""; + for (var i = 3; i >= 0; i--) { + if (n >= Math.pow(16, i)) { + var t = Math.floor(n / Math.pow(16, i)); + n -= t * Math.pow(16, i); + if ( t >= 10 ) { + if ( t == 10 ) { h += "A"; } + if ( t == 11 ) { h += "B"; } + if ( t == 12 ) { h += "C"; } + if ( t == 13 ) { h += "D"; } + if ( t == 14 ) { h += "E"; } + if ( t == 15 ) { h += "F"; } + } else { + h += String(t); + } + } else { + h += "0"; + } + } + return h; +} + diff --git a/js/src/tests/test262/ch07/7.4/browser.js b/js/src/tests/test262/ch07/7.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/browser.js diff --git a/js/src/tests/test262/ch07/7.4/shell.js b/js/src/tests/test262/ch07/7.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch07/7.4/shell.js |