diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.1')
69 files changed, 1820 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/11.1.1-1gs.js b/js/src/tests/test262/ch11/11.1/11.1.1/11.1.1-1gs.js new file mode 100644 index 000000000..0f2b30b5d --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.1/11.1.1-1gs.js @@ -0,0 +1,16 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+
+/**
+ * @path ch11/11.1/11.1.1/11.1.1-1gs.js
+ * @description Strict Mode - 'this' object at the global scope is not undefined
+ * @onlyStrict
+ */
+
+"use strict";
+if (this===undefined) {
+ throw NotEarlyError;
+}
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A1.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A1.js new file mode 100644 index 000000000..c68c32736 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A1.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. + +/** + * The "this" is reserved word + * + * @path ch11/11.1/11.1.1/S11.1.1_A1.js + * @description Checking if execution of "this=1" fails + * @negative + */ + +this = 1; + diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.1.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.1.js new file mode 100644 index 000000000..4094fa914 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Being in function code, "this" and eval("this"), called as a functions, return the global object + * + * @path ch11/11.1/11.1.1/S11.1.1_A3.1.js + * @description Creating function which returns "this" or eval("this") + * @noStrict + */ + +//CHECK#1 +function MyFunction() {return this} +if (MyFunction() !== this) { + $ERROR('#1: function MyFunction() {return this} MyFunction() === this. Actual: ' + (MyFunction())); +} + +//CHECK#2 +function MyFunction() {return eval("this")} +if (MyFunction() !== this) { + $ERROR('#2: function MyFunction() {return eval("this")} MyFunction() === this. Actual: ' + (MyFunction())); +} + + + diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.2.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.2.js new file mode 100644 index 000000000..ca0d5e699 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Being in function code, "this" and eval("this"), called as a constructors, return the object + * + * @path ch11/11.1/11.1.1/S11.1.1_A3.2.js + * @description Create function. It have property, that returned "this" + * @noStrict + */ + +//CHECK#1 +function MyFunction() {this.THIS = this} +if ((new MyFunction()).THIS.toString() !== "[object Object]") { + $ERROR('#1: function MyFunction() {this.THIS = this} (new MyFunction()).THIS.toString() !== "[object Object]". Actual: ' + ((new MyFunction()).THIS.toString())); +} + +//CHECK#2 +function MyFunction() {this.THIS = eval("this")} +if ((new MyFunction()).THIS.toString() !== "[object Object]") { + $ERROR('#2: function MyFunction() {this.THIS = eval("this")} (new MyFunction()).THIS.toString() !== "[object Object]". Actual: ' + ((new MyFunction()).THIS.toString())); +} + + diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.1.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.1.js new file mode 100644 index 000000000..38e2adbbd --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Being in anonymous code, "this" and eval("this"), called as a function, return the global object + * + * @path ch11/11.1/11.1.1/S11.1.1_A4.1.js + * @description Creating function with new Function() constructor + */ + +//CHECK#1 +var MyFunction = new Function("return this"); +if (MyFunction() !== this) { + $ERROR('#1: var MyFunction = new Function("return this"); MyFunction() === this. Actual: ' + (MyFunction())); +} + +//CHECK#2 +MyFunction = new Function("return eval(\'this\')"); +if (MyFunction() !== this) { + $ERROR('#2: var MyFunction = new Function("return eval(\'this\')"); MyFunction() === this. Actual: ' + (MyFunction())); +} + + + diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.2.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.2.js new file mode 100644 index 000000000..cd37d6824 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Being in anonymous code, "this" and eval("this"), called as a constructor, return the object + * + * @path ch11/11.1/11.1.1/S11.1.1_A4.2.js + * @description Creating function by using new Function() constructor. It has the property, which returns "this" + */ + +//CHECK#1 +var MyFunction = new Function("this.THIS = this"); +var MyObject = new MyFunction(); +if (MyObject.THIS.toString() !== "[object Object]") { + $ERROR('#1: var MyFunction = new Function("this.THIS = this"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString())); +} + +//CHECK#2 +MyFunction = new Function("this.THIS = eval(\'this\')"); +MyObject = new MyFunction(); +if (MyObject.THIS.toString() !== "[object Object]") { + $ERROR('#2: var MyFunction = new Function("this.THIS = eval(\'this\')"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString())); +} + + diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/browser.js b/js/src/tests/test262/ch11/11.1/11.1.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.1/browser.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/shell.js b/js/src/tests/test262/ch11/11.1/11.1.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.1/shell.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.2/S11.1.2_A1_T1.js b/js/src/tests/test262/ch11/11.1/11.1.2/S11.1.2_A1_T1.js new file mode 100644 index 000000000..46955d3ca --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.2/S11.1.2_A1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of evaluating an Identifier is always a value of type Reference + * + * @path ch11/11.1/11.1.2/S11.1.2_A1_T1.js + * @description Creating variables without defining it + */ + +//CHECK#1 +if (this.x !== undefined) { + $ERROR('#1: this.x === undefined. Actual: ' + (this.x)); +} + +//CHECK#2 +var object = new Object(); +if (object.prop !== undefined) { + $ERROR('#2: var object = new Object(); object.prop === undefined. Actual: ' + (object.prop)); +} + +//CHECK#3 +this.y++; +if (isNaN(y) !== true) { + $ERROR('#3: this.y++; y === Not-a-Number. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.2/S11.1.2_A1_T2.js b/js/src/tests/test262/ch11/11.1/11.1.2/S11.1.2_A1_T2.js new file mode 100644 index 000000000..df170468d --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.2/S11.1.2_A1_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. + +/** + * The result of evaluating an Identifier is always a value of type Reference + * + * @path ch11/11.1/11.1.2/S11.1.2_A1_T2.js + * @description Trying to generate ReferenceError + */ + +//CHECK#1 +try { + this.z; + z; + $ERROR('#1.1: this.z; z === undefined throw ReferenceError. Actual: ' + (z)); +} catch(e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: this.z; z === undefined throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.2/browser.js b/js/src/tests/test262/ch11/11.1/11.1.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.2/browser.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.2/shell.js b/js/src/tests/test262/ch11/11.1/11.1.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.2/shell.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4-0.js b/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4-0.js new file mode 100644 index 000000000..60d4b1d8c --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4-0.js @@ -0,0 +1,18 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.4/11.1.4-0.js
+ * @description elements elided at the end of an array do not contribute to its length
+ */
+
+
+function testcase() {
+ var a = [,];
+ if (a.length === 1) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4_4-5-1.js b/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4_4-5-1.js new file mode 100644 index 000000000..15de1077b --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4_4-5-1.js @@ -0,0 +1,32 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.4;
+ * The production
+ * ElementList : Elisionopt AssignmentExpression
+ * 5.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(firstIndex), the Property Descriptor { [[Value]]: initValue, [[Writable]]: true
+ * , [[Enumerable]]: true, [[Configurable]]: true}, and false.
+ *
+ * @path ch11/11.1/11.1.4/11.1.4_4-5-1.js
+ * @description Initialize array using ElementList (Elisionopt AssignmentExpression) when index property (read-only) exists in Array.prototype (step 5)
+ */
+
+
+function testcase() {
+ try {
+ Object.defineProperty(Array.prototype, "0", {
+ value: 100,
+ writable: false,
+ configurable: true
+ });
+ var arr = [101];
+
+ return arr.hasOwnProperty("0") && arr[0] === 101;
+ } finally {
+ delete Array.prototype[0];
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4_5-6-1.js b/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4_5-6-1.js new file mode 100644 index 000000000..14e02a1b7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/11.1.4_5-6-1.js @@ -0,0 +1,32 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.4;
+ * The production
+ * ElementList : ElementList , Elisionopt AssignmentExpression
+ * 6.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(ToUint32((pad+len)) and the Property Descriptor { [[Value]]: initValue
+ * , [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false.
+ *
+ * @path ch11/11.1/11.1.4/11.1.4_5-6-1.js
+ * @description Initialize array using ElementList (ElementList , Elisionopt AssignmentExpression) when index property (read-only) exists in Array.prototype (step 6)
+ */
+
+
+function testcase() {
+ try {
+ Object.defineProperty(Array.prototype, "1", {
+ value: 100,
+ writable: false,
+ configurable: true
+ });
+ var arr = [101, 12];
+
+ return arr.hasOwnProperty("1") && arr[1] === 12;
+ } finally {
+ delete Array.prototype[1];
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.1.js b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.1.js new file mode 100644 index 000000000..6e202534b --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ArrayLiteral: [ ] + * + * @path ch11/11.1/11.1.4/S11.1.4_A1.1.js + * @description Checking various properties of the array defined with expression "var array = []" + */ + +var array = []; + +//CHECK#1 +if (typeof array !== "object") { + $ERROR('#1: var array = []; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + $ERROR('#2: var array = []; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + $ERROR('#3: var array = []; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 0) { + $ERROR('#4: var array = []; array.length === 0. Actual: ' + (array.length)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.2.js b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.2.js new file mode 100644 index 000000000..e1b0ff3ee --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ArrayLiteral: [ Elision ] + * + * @path ch11/11.1/11.1.4/S11.1.4_A1.2.js + * @description Checking various properties the array defined with "var array = [,,,,,]" + */ + +var array = [,,,,,]; + +//CHECK#1 +if (typeof array !== "object") { + $ERROR('#1: var array = [,,,,,]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + $ERROR('#2: var array = [,,,,,]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + $ERROR('#3: var array = [,,,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + $ERROR('#4: var array = [,,,,,]; array.length === 5. Actual: ' + (array.length)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.3.js b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.3.js new file mode 100644 index 000000000..6682a8eef --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.3.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. + +/** + * Evaluate the production ArrayLiteral: [ AssignmentExpression ] + * + * @path ch11/11.1/11.1.4/S11.1.4_A1.3.js + * @description Checking various properteis and contents of the array defined with "var array = [1,2,3,4,5]" + */ + +var array = [1,2,3,4,5]; + +//CHECK#1 +if (typeof array !== "object") { + $ERROR('#1: var array = [1,2,3,4,5]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + $ERROR('#2: var array = [1,2,3,4,5]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + $ERROR('#3: var array = [1,2,3,4,5]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + $ERROR('#4: var array = [1,2,3,4,5]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== 1) { + $ERROR('#5: var array = [1,2,3,4,5]; array[0] === 1. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== 2) { + $ERROR('#6: var array = [1,2,3,4,5]; array[1] === 2. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== 3) { + $ERROR('#7: var array = [1,2,3,4,5]; array[2] === 3. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== 4) { + $ERROR('#8: var array = [1,2,3,4,5]; array[3] === 4. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== 5) { + $ERROR('#9: var array = [1,2,3,4,5]; array[4] === 5. Actual: ' + (array[4])); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.4.js b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.4.js new file mode 100644 index 000000000..28e67233e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.4.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. + +/** + * Evaluate the production ArrayLiteral: [ Elision, AssignmentExpression ] + * + * @path ch11/11.1/11.1.4/S11.1.4_A1.4.js + * @description Checking various properteis and content of the array defined with "var array = [,,,1,2]" + */ + +var array = [,,,1,2]; + +//CHECK#1 +if (typeof array !== "object") { + $ERROR('#1: var array = [,,,1,2]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + $ERROR('#2: var array = [,,,1,2]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + $ERROR('#3: var array = [,,,1,2]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + $ERROR('#4: var array = [,,,1,2]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== undefined) { + $ERROR('#5: var array = [,,,1,2]; array[0] === undefined. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== undefined) { + $ERROR('#6: var array = [,,,1,2]; array[1] === undefined. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== undefined) { + $ERROR('#7: var array = [,,,1,2]; array[2] === undefined. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== 1) { + $ERROR('#8: var array = [,,,1,2]; array[3] === 1. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== 2) { + $ERROR('#9: var array = [,,,1,2]; array[4] === 2. Actual: ' + (array[4])); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.5.js b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.5.js new file mode 100644 index 000000000..d08183f2e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.5.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. + +/** + * Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision ] + * + * @path ch11/11.1/11.1.4/S11.1.4_A1.5.js + * @description Checking various properteis and contents of the array defined with "var array = [4,5,,,,]" + */ + +var array = [4,5,,,,]; + +//CHECK#1 +if (typeof array !== "object") { + $ERROR('#1: var array = [4,5,,,,]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + $ERROR('#2: var array = [4,5,,,,]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + $ERROR('#3: var array = [4,5,,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + $ERROR('#4: var array = [4,5,,,,]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== 4) { + $ERROR('#5: var array = [4,5,,,,]; array[0] === 4. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== 5) { + $ERROR('#6: var array = [4,5,,,,]; array[1] === 5. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== undefined) { + $ERROR('#7: var array = [4,5,,,,]; array[2] === undefined. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== undefined) { + $ERROR('#8: var array = [4,5,,,,]; array[3] === undefined. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== undefined) { + $ERROR('#9: var array = [4,5,,,,]; array[4] === undefined. Actual: ' + (array[4])); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.6.js b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.6.js new file mode 100644 index 000000000..589eb3c0d --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.6.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. + +/** + * Evaluate the production ArrayLiteral: [ Elision, AssignmentExpression, Elision ] + * + * @path ch11/11.1/11.1.4/S11.1.4_A1.6.js + * @description Checking various properteis and contents of the array defined with "var array = [,,3,,,]" + */ + +var array = [,,3,,,]; + +//CHECK#1 +if (typeof array !== "object") { + $ERROR('#1: var array = [,,3,,,]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + $ERROR('#2: var array = [,,3,,,]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + $ERROR('#3: var array = [,,3,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + $ERROR('#4: var array = [,,3,,,]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== undefined) { + $ERROR('#5: var array = [,,3,,,]; array[0] === undefined. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== undefined) { + $ERROR('#6: var array = [,,3,,,]; array[1] === undefined. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== 3) { + $ERROR('#7: var array = [,,3,,,]; array[2] === 3. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== undefined) { + $ERROR('#8: var array = [,,3,,,]; array[3] === undefined. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== undefined) { + $ERROR('#9: var array = [,,3,,,]; array[4] === undefined. Actual: ' + (array[4])); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.7.js b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.7.js new file mode 100644 index 000000000..4689d6b00 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A1.7.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. + +/** + * Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision, AssignmentExpression ] + * + * @path ch11/11.1/11.1.4/S11.1.4_A1.7.js + * @description Checking various properteis and contents of the array defined with "var array = [1,2,,4,5]" + */ + +var array = [1,2,,4,5]; + +//CHECK#1 +if (typeof array !== "object") { + $ERROR('#1: var array = [1,2,,4,5]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + $ERROR('#2: var array = [1,2,,4,5]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + $ERROR('#3: var array = [1,2,,4,5]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + $ERROR('#4: var array = [1,2,,4,5]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== 1) { + $ERROR('#5: var array = [1,2,,4,5]; array[0] === 1. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== 2) { + $ERROR('#6: var array = [1,2,,4,5]; array[1] === 2. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== undefined) { + $ERROR('#7: var array = [1,2,,4,5]; array[2] === undefined. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== 4) { + $ERROR('#8: var array = [1,2,,4,5]; array[3] === 4. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== 5) { + $ERROR('#9: var array = [1,2,,4,5]; array[4] === 5. Actual: ' + (array[4])); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A2.js b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A2.js new file mode 100644 index 000000000..3e1c699fb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/S11.1.4_A2.js @@ -0,0 +1,128 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Create multi dimensional array + * + * @path ch11/11.1/11.1.4/S11.1.4_A2.js + * @description Checking various properteis and contents of the arrya defined with "var array = [[1,2], [3], []]" + */ + +var array = [[1,2], [3], []]; + +//CHECK#1 +if (typeof array !== "object") { + $ERROR('#1: var array = [[1,2], [3], []]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + $ERROR('#2: var array = [[1,2], [3], []]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + $ERROR('#3: var array = [[1,2], [3], []]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 3) { + $ERROR('#4: var array = [[1,2], [3], []]; array.length === 3. Actual: ' + (array.length)); +} + +var subarray = array[0]; + +//CHECK#5 +if (typeof subarray !== "object") { + $ERROR('#5: var array = [[1,2], [3], []]; var subarray = array[0]; typeof subarray === "object". Actual: ' + (typeof subarray)); +} + +//CHECK#6 +if (subarray instanceof Array !== true) { + $ERROR('#6: var array = [[1,2], [3], []]; var subarray = array[0]; subarray instanceof Array === true'); +} + +//CHECK#7 +if (subarray.toString !== Array.prototype.toString) { + $ERROR('#7: var array = [[1,2], [3], []]; var subarray = array[0]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString)); +} + +//CHECK#8 +if (subarray.length !== 2) { + $ERROR('#8: var array = [[1,2], [3], []]; var subarray = array[0]; subarray.length === 2. Actual: ' + (subarray.length)); +} + +//CHECK#9 +if (subarray[0] !== 1) { + $ERROR('#9: var array = [[1,2], [3], []]; var subarray = array[0]; subarray[0] === 1. Actual: ' + (subarray[0])); +} + +//CHECK#10 +if (subarray[1] !== 2) { + $ERROR('#10: var array = [[1,2], [3], []]; var subarray = array[1]; subarray[1] === 2. Actual: ' + (subarray[1])); +} + +var subarray = array[1]; + +//CHECK#11 +if (typeof subarray !== "object") { +$ERROR('#11: var array = [[1,2], [3], []]; var subarray = array[1]; typeof subarray === "object". Actual: ' + (typeof subarray)); +} + +//CHECK#12 +if (subarray instanceof Array !== true) { +$ERROR('#12: var array = [[1,2], [3], []]; var subarray = array[1]; subarray instanceof Array === true'); +} + +//CHECK#13 +if (subarray.toString !== Array.prototype.toString) { +$ERROR('#13: var array = [[1,2], [3], []]; var subarray = array[1]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString)); +} + +//CHECK#14 +if (subarray.length !== 1) { +$ERROR('#14: var array = [[1,2], [3], []]; var subarray = array[1]; subarray.length === 1. Actual: ' + (subarray.length)); +} + +//CHECK#15 +if (subarray[0] !== 3) { +$ERROR('#15: var array = [[1,2], [3], []]; var subarray = array[1]; subarray[0] === 3. Actual: ' + (subarray[0])); +} + +var subarray = array[2]; + +//CHECK#16 +if (typeof subarray !== "object") { +$ERROR('#16: var array = [[1,2], [3], []]; var subarray = array[2]; typeof subarray === "object". Actual: ' + (typeof subarray)); +} + +//CHECK#17 +if (subarray instanceof Array !== true) { +$ERROR('#17: var array = [[1,2], [3], []]; var subarray = array[2]; subarray instanceof Array === true'); +} + +//CHECK#18 +if (subarray.toString !== Array.prototype.toString) { +$ERROR('#18: var array = [[1,2], [3], []]; var subarray = array[2]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString)); +} + +//CHECK#19 +if (subarray.length !== 0) { +$ERROR('#19: var array = [[1,2], [3], []]; var subarray = array[2]; subarray.length === 0. Actual: ' + (subarray.length)); +} + +//CHECK#20 +if (array[0][0] !== 1) { + $ERROR('#20: var array = [[1,2], [3], []]; array[0][0] === 1. Actual: ' + (array[0][0])); +} + +//CHECK#21 +if (array[0][1] !== 2) { + $ERROR('#21: var array = [[1,2], [3], []]; array[0][1] === 2. Actual: ' + (array[0][1])); +} + +//CHECK#22 +if (array[1][0] !== 3) { + $ERROR('#722: var array = [[1,2], [3], []]; array[1][0] === 3. Actual: ' + (array[1][0])); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/browser.js b/js/src/tests/test262/ch11/11.1/11.1.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/browser.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.4/shell.js b/js/src/tests/test262/ch11/11.1/11.1.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.4/shell.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-1.js new file mode 100644 index 000000000..5ff963de5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-1.js @@ -0,0 +1,27 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * it isn't clear what specific requirements of the specificaiton are being tested here. This test should
+ * probably be replaced by some more targeted tests. AllenWB
+ *
+ * @path ch11/11.1/11.1.5/11.1.5-0-1.js
+ * @description Object literal - get set property
+ */
+
+
+function testcase() {
+ var s1 = "In getter";
+ var s2 = "In setter";
+ var s3 = "Modified by setter";
+ eval("var o = {get foo(){ return s1;},set foo(arg){return s2 = s3}};");
+ if(o.foo !== s1)
+ return false;
+ o.foo=10;
+ if(s2 !== s3)
+ return false;
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-2.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-2.js new file mode 100644 index 000000000..3f820b441 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-2.js @@ -0,0 +1,32 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * it isn't clear what specific requirements of the specificaiton are being tested here. This test should
+ * probably be replaced by some more targeted tests. AllenWB
+ *
+ * @path ch11/11.1/11.1.5/11.1.5-0-2.js
+ * @description Object literal - multiple get set properties
+ */
+
+
+function testcase() {
+ var s1 = "First getter";
+ var s2 = "First setter";
+ var s3 = "Second getter";
+ eval("var o = {get foo(){ return s1;},set foo(arg){return s2 = s3}, get bar(){ return s3}, set bar(arg){ s3 = arg;}};");
+ if(o.foo !== s1)
+ return false;
+ o.foo = 10;
+ if(s2 !== s3)
+ return false;
+ if(o.bar !== s3)
+ return false;
+ o.bar = "Second setter";
+ if(o.bar !== "Second setter")
+ return false;
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1-s.js new file mode 100644 index 000000000..371c0aceb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1-s.js @@ -0,0 +1,23 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5-1-s.js
+ * @description Strict Mode - SyntaxError is thrown when 'eval' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = {set _11_1_5_1_fun(eval) {}};");
+ return false;
+ } catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1gs.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1gs.js new file mode 100644 index 000000000..6d7766e3e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1gs.js @@ -0,0 +1,14 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5-1gs.js
+ * @description Strict Mode - SyntaxError is thrown when 'eval' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+"use strict";
+throw NotEarlyError;
+var obj = { set _11_1_5_1_fun(eval) {}};
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2-s.js new file mode 100644 index 000000000..5b763b78a --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2-s.js @@ -0,0 +1,23 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5-2-s.js
+ * @description Strict Mode - SyntaxError is thrown when 'arguments' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = {set _11_1_5_2_fun(arguments) {} };");
+ return false;
+ } catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2gs.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2gs.js new file mode 100644 index 000000000..f45f20b51 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2gs.js @@ -0,0 +1,14 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5-2gs.js
+ * @description Strict Mode - SyntaxError is thrown when eval code contains an ObjectLiteral with more than one definition of any data property
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+"use strict";
+throw NotEarlyError;
+var obj = { _11_1_5_2_gs: 10, _11_1_5_2_gs: 10 };
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-3-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-3-s.js new file mode 100644 index 000000000..72219037e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-3-s.js @@ -0,0 +1,22 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5-3-s.js
+ * @description Strict Mode - SyntaxError is thrown when 'evals' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment if its FunctionBody is strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("var obj = {set _11_1_5_3_fun(eval) { \"use strict\"; }};");
+ return false;
+ } catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-4-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-4-s.js new file mode 100644 index 000000000..8e4185c91 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-4-s.js @@ -0,0 +1,22 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5-4-s.js
+ * @description Strict Mode - SyntaxError is thrown when 'arguments' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment if its FunctionBody is strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("var obj = {set _11_1_5_4_fun(arguments) {\"use strict\";}};");
+ return false;
+ } catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_3-3-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_3-3-1.js new file mode 100644 index 000000000..54b381128 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_3-3-1.js @@ -0,0 +1,31 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyNameAndValueList : PropertyAssignment
+ * 3.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false.
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_3-3-1.js
+ * @description Object initialization using PropertyNameAndValueList (PropertyAssignment) when property (read-only) exists in Object.prototype (step 3)
+ */
+
+
+function testcase() {
+ try {
+ Object.defineProperty(Object.prototype, "prop", {
+ value: 100,
+ writable: false,
+ configurable: true
+ });
+ var obj = { prop: 12 };
+
+ return obj.hasOwnProperty("prop") && obj.prop === 12;
+ } finally {
+ delete Object.prototype.prop;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-2.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-2.js new file mode 100644 index 000000000..837c309b3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-2.js @@ -0,0 +1,23 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
+ * 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
+ * a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_4-4-a-2.js
+ * @description Object literal - Duplicate data property name allowed if not in strict mode
+ */
+
+
+function testcase() {
+
+ eval("({foo:0,foo:1});");
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-3.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-3.js new file mode 100644 index 000000000..9d37ec89d --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-3.js @@ -0,0 +1,23 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
+ * 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
+ * a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_4-4-a-3.js
+ * @description Object literal - Duplicate data property name allowed gets last defined value
+ */
+
+
+function testcase() {
+
+ var o = eval("({foo:0,foo:1});");
+ return o.foo===1;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-5-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-5-1.js new file mode 100644 index 000000000..ff06c134b --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-5-1.js @@ -0,0 +1,32 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
+ * 5.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false.
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_4-5-1.js
+ * @description Object initialization using PropertyNameAndValueList (PropertyNameAndValueList , PropertyAssignment) when property (read-only) exists in Object.prototype (Step 5)
+ */
+
+
+function testcase() {
+ try {
+ Object.defineProperty(Object.prototype, "prop2", {
+ value: 100,
+ writable: false,
+ configurable: true
+ });
+
+ var obj = { prop1: 101, prop2: 12 };
+
+ return obj.hasOwnProperty("prop2");
+ } finally {
+ delete Object.prototype.prop2;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_5-4-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_5-4-1.js new file mode 100644 index 000000000..7af0a34ec --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_5-4-1.js @@ -0,0 +1,27 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : PropertyName : AssignmentExpression
+ * 4.Let desc be the Property Descriptor{[[Value]]: propValue, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_5-4-1.js
+ * @description Object literal - property descriptor for assignment expression
+ */
+
+
+function testcase() {
+
+ var o = {foo : 1};
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ if(desc.value === 1 &&
+ desc.writable === true &&
+ desc.enumerable === true &&
+ desc.configurable === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-1-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-1-s.js new file mode 100644 index 000000000..090d90944 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-1-s.js @@ -0,0 +1,30 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5_6-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word or a future reserved word is contained in strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = {\
+ get _11_1_5_6_2_1() {\
+ public = 42;\
+ return public;\
+ }\
+ };");
+
+ var _11_1_5_6_2_1 = obj._11_1_5_6_2_1;
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-2-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-2-s.js new file mode 100644 index 000000000..32afa56ed --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-2-s.js @@ -0,0 +1,29 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5_6-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word or a future reserved word is made inside a strict mode FunctionBody of a PropertyAssignment
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("var obj = {\
+ get _11_1_5_6_2_2() {\
+ \"use strict\";\
+ public = 42;\
+ return public;\
+ }\
+ };\
+ var _11_1_5_6_2_2 = obj._11_1_5_6_2_2;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-1.js new file mode 100644 index 000000000..6514561d9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-1.js @@ -0,0 +1,25 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : get PropertyName ( ) { FunctionBody }
+ * 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_6-3-1.js
+ * @description Object literal - property descriptor for get property assignment
+ */
+
+
+function testcase() {
+
+ eval("var o = {get foo(){return 1;}};");
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ if(desc.enumerable === true &&
+ desc.configurable === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-2.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-2.js new file mode 100644 index 000000000..dc0665d69 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-2.js @@ -0,0 +1,23 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : get PropertyName ( ) { FunctionBody }
+ * 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_6-3-2.js
+ * @description Object literal - property descriptor for get property assignment should not create a set function
+ */
+
+
+function testcase() {
+
+ eval("var o = {get foo(){return 1;}};");
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ return desc.set === undefined
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-1-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-1-s.js new file mode 100644 index 000000000..71aacfa2e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-1-s.js @@ -0,0 +1,30 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5_7-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word is contained in strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var data = \"data\";\
+ var obj = {\
+ set _11_1_5_7_2_1(value) {\
+ public = 42;\
+ data = value;\
+ }\
+ };\
+ obj._11_1_5_7_2_1 = 1;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-2-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-2-s.js new file mode 100644 index 000000000..b351a43f7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-2-s.js @@ -0,0 +1,30 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.1/11.1.5/11.1.5_7-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word is made in a strict FunctionBody of a PropertyAssignment
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var data = \"data\";\
+ var obj = {\
+ set _11_1_5_7_2_2(value) {\
+ public = 42;\
+ data = value;\
+ }\
+ };\
+ obj._11_1_5_7_2_2 = 1;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-1.js new file mode 100644 index 000000000..ae453873d --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-1.js @@ -0,0 +1,25 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : set PropertyName( PropertySetParameterList ) { FunctionBody }
+ * 3.Let desc be the Property Descriptor{[[Set]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_7-3-1.js
+ * @description Object literal - property descriptor for set property assignment
+ */
+
+
+function testcase() {
+
+ eval("var o = {set foo(arg){return 1;}};");
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ if(desc.enumerable === true &&
+ desc.configurable === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-2.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-2.js new file mode 100644 index 000000000..216f80a2e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-2.js @@ -0,0 +1,23 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : get PropertyName ( ) { FunctionBody }
+ * 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_7-3-2.js
+ * @description Object literal - property descriptor for set property assignment should not create a get function
+ */
+
+
+function testcase() {
+
+ eval("var o = {set foo(arg){}};");
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ return desc.get === undefined
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.1.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.1.js new file mode 100644 index 000000000..0f4a1936e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { } + * + * @path ch11/11.1/11.1.5/S11.1.5_A1.1.js + * @description Checking various properteis of the object defined with "var object = {}" + */ + +var object = {}; + +//CHECK#1 +if (typeof object !== "object") { + $ERROR('#1: var object = {}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + $ERROR('#2: var object = {}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + $ERROR('#3: var object = {}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object.toString() !== "[object Object]") { + $ERROR('#4: var object = {}; object.toString === "[object Object]". Actual: ' + (object.toString)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.2.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.2.js new file mode 100644 index 000000000..9eff82640 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.2.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { NumericLiteral : AssignmentExpression} + * + * @path ch11/11.1/11.1.5/S11.1.5_A1.2.js + * @description Checking various properteis and contents of the object defined with "var object = {1 : true}" + */ + +var object = {1 : true}; + +//CHECK#1 +if (typeof object !== "object") { + $ERROR('#1: var object = {1 : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + $ERROR('#2: var object = {1 : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + $ERROR('#3: var object = {1 : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object[1] !== true) { + $ERROR('#4: var object = {1 : true}; object[1] === true'); +} + +//CHECK#5 +if (object["1"] !== true) { + $ERROR('#5: var object = {1 : true}; object["1"] === true'); +} + + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.3.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.3.js new file mode 100644 index 000000000..dea77e509 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.3.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { StringLiteral : AssignmentExpression} + * + * @path ch11/11.1/11.1.5/S11.1.5_A1.3.js + * @description Checking various properteis and contents of the object defined with "var object = {"x" : true}" + */ + +var object = {"x" : true}; + +//CHECK#1 +if (typeof object !== "object") { + $ERROR('#1: var object = {"x" : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + $ERROR('#2: var object = {"x" : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + $ERROR('#3: var object = {"x" : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object["x"] !== true) { + $ERROR('#4: var object = {"x" : true}; object["x"] === true'); +} + +//CHECK#5 +if (object.x !== true) { + $ERROR('#5: var object = {"x" : true}; object.x === true'); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.4.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.4.js new file mode 100644 index 000000000..5919596dc --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.4.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { Identifier : AssignmentExpression} + * + * @path ch11/11.1/11.1.5/S11.1.5_A1.4.js + * @description Checking various properteis and contents of the object defined with "var object = {prop : true}" + */ + +var object = {prop : true}; + +//CHECK#1 +if (typeof object !== "object") { + $ERROR('#1: var object = {prop : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + $ERROR('#2: var object = {prop : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + $ERROR('#3: var object = {prop : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object["prop"] !== true) { + $ERROR('#4: var object = {prop : true}; object["prop"] === true'); +} + +//CHECK#5 +if (object.prop !== true) { + $ERROR('#5: var object = {prop : true}; object.prop === true'); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A2.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A2.js new file mode 100644 index 000000000..808578392 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A2.js @@ -0,0 +1,94 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { PropertyName : AssignmentExpression } + * + * @path ch11/11.1/11.1.5/S11.1.5_A2.js + * @description Creating property "prop" of various types(boolean, number and etc.) + */ + +//CHECK#1 +var x = true; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#1: var x = true; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#2 +var x = new Boolean(true); +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#2: var x = new Boolean(true); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#3 +var x = 1; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#3: var x = 1; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#4 +var x = new Number(1); +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#4: var x = new Number(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#5 +var x = "1"; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#5: var x = "1"; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#6 +var x = new String(1); +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#6: var x = new String(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#7 +var x = undefined; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#7: var x = undefined; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#8 +var x = null; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#8: var x = null; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#9 +var x = {}; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#9: var x = {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#10 +var x = [1,2]; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#10: var x = [1,2]; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#11 +var x = function() {}; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#11: var x = function() {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#12 +var x = this; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#12: var x = this; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A3.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A3.js new file mode 100644 index 000000000..1d0024a9f --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { PropertyNameAndValueList } + * + * @path ch11/11.1/11.1.5/S11.1.5_A3.js + * @description Creating the object defined with "var object = {0 : 1, "1" : "x", o : {}}" + */ + +var object = {0 : 1, "1" : "x", o : {}}; + +//CHECK#1 +if (object[0] !== 1) { + $ERROR('#1: var object = {0 : 1; "1" : "x"; o : {}}; object[0] === 1. Actual: ' + (object[0])); +} + +//CHECK#2 +if (object["1"] !== "x") { + $ERROR('#2: var object = {0 : 1; "1" : "x"; o : {}}; object["1"] === "x". Actual: ' + (object["1"])); +} + +//CHECK#3 +if (typeof object.o !== "object") { + $ERROR('#1: var object = {0 : 1; "1" : "x"; o : {}}; typeof object.o === "object". Actual: ' + (typeof object.o)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.1.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.1.js new file mode 100644 index 000000000..b1d2a2f90 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.1.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. + +/** + * The PropertyName is not really a BooleanLiteral + * + * @path ch11/11.1/11.1.5/S11.1.5_A4.1.js + * @description Checking if execution of "var object = {true : 1}" does not fail + */ + +//CHECK#1 +var object = {true : 1}; + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.2.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.2.js new file mode 100644 index 000000000..ebeb5fbc6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The PropertyName is not really a nullLiteral + * + * @path ch11/11.1/11.1.5/S11.1.5_A4.2.js + * @description Checking if execution of "var object = {null : true}" does not fail + */ + +//CHECK#1 +var object = {null : true}; diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.3.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.3.js new file mode 100644 index 000000000..03c89ee99 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The PropertyName is undefined, ToString(BooleanLiteral), ToString(nullLiteral) + * + * @path ch11/11.1/11.1.5/S11.1.5_A4.3.js + * @description Creating properties with following names: undefined, 'true', 'null' + */ + +//CHECK#1 +var object = {undefined : true}; +if (object.undefined !== true) { + $ERROR('#1: var object = {undefined : true}; object.undefined === true'); +} + +//CHECK#2 +var object = {undefined : true}; +if (object["undefined"] !== true) { + $ERROR('#2: var object = {undefined : true}; object["undefined"] === true'); +} + +//CHECK#3 +var object = {"true" : true}; +if (object["true"] !== true) { + $ERROR('#3: var object = {"true" : true}; object["true"] === true'); +} + +//CHECK#4 +var object = {"null" : true}; +if (object["null"] !== true) { + $ERROR('#4: var object = {"null" : true}; object["null"] === true'); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/browser.js b/js/src/tests/test262/ch11/11.1/11.1.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/browser.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/shell.js b/js/src/tests/test262/ch11/11.1/11.1.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/shell.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A1.js b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A1.js new file mode 100644 index 000000000..d6b8323a8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * White Space and Line Terminator inside "grouping" operator are allowed + * + * @path ch11/11.1/11.1.6/S11.1.6_A1.js + * @description Inserting WhiteSpaces and LineTerminators into grouping operator. Eval is used + */ + +//CHECK#1 +if (eval("(\u00091\u0009)") !== 1) { + $ERROR('#1: (\\u00091\\u0009) === 1'); +} + +//CHECK#2 +if (eval("(\u000B1\u000B)") !== 1) { + $ERROR('#2: (\\u000B1\\u000B) === 1'); +} + +//CHECK#3 +if (eval("(\u000C1\u000C)") !== 1) { + $ERROR('#3: (\\u000C1\\u000C) === 1'); +} + +//CHECK#4 +if (eval("(\u00201\u0020)") !== 1) { + $ERROR('#4: (\\u00201\\u0020 === 1'); +} + +//CHECK#5 +if (eval("(\u00A01\u00A0)") !== 1) { + $ERROR('#5: (\\u00A01\\u00A0) === 1'); +} + +//CHECK#6 +if (eval("(\u000A1\u000A)") !== 1) { + $ERROR('#6: (\\u000A1\\u000A) === 1'); +} + +//CHECK#7 +if (eval("(\u000D1\u000D)") !== 1) { + $ERROR('#7: (\\u000D1\\u000D) === 1'); +} + +//CHECK#8 +if (eval("(\u20281\u2028)") !== 1) { + $ERROR('#8: (\\u20281\\u2028) === 1'); +} + +//CHECK#9 +if (eval("(\u20291\u2029)") !== 1) { + $ERROR('#9: (\\u20291\\u2029) === 1'); +} + +//CHECK#10 +if (eval("(\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029)") !== 1) { + $ERROR('#10: (\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029) === 1'); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A2.js b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A2.js new file mode 100644 index 000000000..30d5c290c --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A2.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "This" operator doesn't use GetValue. The operators "delete" and "typeof" can be applied to parenthesised expressions + * + * @path ch11/11.1/11.1.6/S11.1.6_A2.js + * @description Applying "delete" and "typeof" operators to an undefined variable and a property of an object + */ + +//CHECK#1 +if (delete (x) !== true) { + $ERROR('#1: delete (x) === true'); +} + +//CHECK#2 +if (typeof (x) !== "undefined") { + $ERROR('#2: typeof (x) === "undefined". Actual: ' + (typeof (x))); +} + +var object = {}; +//CHECK#3 +if (delete (object.prop) !== true) { + $ERROR('#3: var object = {}; delete (object.prop) === true'); +} + +//CHECK#4 +if (typeof (object.prop) !== "undefined") { + $ERROR('#4: var object = {}; typeof (object.prop) === "undefined". Actual: ' + (typeof (object.prop))); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T1.js b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T1.js new file mode 100644 index 000000000..26a030104 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "This" operator only evaluates Expression + * + * @path ch11/11.1/11.1.6/S11.1.6_A3_T1.js + * @description Applying grouping operator to Boolean + */ + +// Check for Boolean + +//CHECK#1 +if ((true) !== true) { + $ERROR('#1: (true) === true'); +} + +//CHECK#2 +var x = new Boolean(true); +if ((x) !== x) { + $ERROR('#2: var x = new Boolean(true); (x) === x. Actual: ' + ((x))); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T2.js b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T2.js new file mode 100644 index 000000000..e29e039f4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "This" operator only evaluates Expression + * + * @path ch11/11.1/11.1.6/S11.1.6_A3_T2.js + * @description Applying grouping operator to Number + */ + +//Check for Number + +//CHECK#1 +if ((1) !== 1) { + $ERROR('#1: (1) === 1. Actual: ' + ((1))); +} + +//CHECK#2 +var x = new Number(1); +if ((x) !== x) { + $ERROR('#2: var x = new Number(1); (x) === x. Actual: ' + ((x))); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T3.js b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T3.js new file mode 100644 index 000000000..a673bd31d --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "This" operator only evaluates Expression + * + * @path ch11/11.1/11.1.6/S11.1.6_A3_T3.js + * @description Applying grouping operator to String + */ + +//Check for String + +//CHECK#1 +if (("1") !== "1") { + $ERROR('#1: ("1") === "1". Actual: ' + (("1"))); +} + +//CHECK#2 +if (("x") !== "x") { + $ERROR('#2: ("x") === "x". Actual: ' + (("x"))); +} + +//CHECK#3 +var x = new Number("1"); +if ((x) !== x) { + $ERROR('#3: var x = new Number("1"); (x) === x. Actual: ' + ((x))); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T4.js b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T4.js new file mode 100644 index 000000000..2c049ccc9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T4.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "This" operator only evaluates Expression + * + * @path ch11/11.1/11.1.6/S11.1.6_A3_T4.js + * @description Applying grouping operator to undefined + */ + +//Check for undefined and null + +//CHECK#1 +if ((undefined) !== undefined) { + $ERROR('#1: (undefined) === undefined. Actual: ' + ((undefined))); +} + +//CHECK#2 +if ((void 0) !== void 0) { + $ERROR('#2: (void 0) === void 0. Actual: ' + ((void 0))); +} + +//CHECK#2 +if ((null) !== null) { + $ERROR('#2: (null) === null. Actual: ' + ((null))); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T5.js b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T5.js new file mode 100644 index 000000000..6fe51bbe9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T5.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "This" operator only evaluates Expression + * + * @path ch11/11.1/11.1.6/S11.1.6_A3_T5.js + * @description Using grouping operator in declaration of variables + */ + +//CHECK#1 +(x) = 1; +if (x !== 1) { + $ERROR('#1: (x) = 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +var y = 1; (y)++; ++(y); (y)--; --(y); +if (y !== 1) { + $ERROR('#2: var y = 1; (y)++; ++(y); (y)--; --(y); y === 1. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T6.js b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T6.js new file mode 100644 index 000000000..e4398bfff --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/S11.1.6_A3_T6.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. + +/** + * "This" operator only evaluates Expression + * + * @path ch11/11.1/11.1.6/S11.1.6_A3_T6.js + * @description Applying grouping operator to delete and typeof operators + */ + +//CHECK#1 +if (delete (x) !== true) { + $ERROR('#1: delete (x) === true'); +} + +//CHECK#2 +if (typeof (x) !== "undefined") { + $ERROR('#2: typeof (x) === "undefined". Actual: ' + (typeof (x))); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/browser.js b/js/src/tests/test262/ch11/11.1/11.1.6/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/browser.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.6/shell.js b/js/src/tests/test262/ch11/11.1/11.1.6/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.6/shell.js diff --git a/js/src/tests/test262/ch11/11.1/browser.js b/js/src/tests/test262/ch11/11.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/browser.js diff --git a/js/src/tests/test262/ch11/11.1/shell.js b/js/src/tests/test262/ch11/11.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/shell.js |