diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.2')
69 files changed, 2127 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A1.1.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A1.1.js new file mode 100644 index 000000000..d8b3561b8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A1.1.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 between MemberExpression or CallExpression and "." and between "." and Identifier are allowed + * + * @path ch11/11.2/11.2.1/S11.2.1_A1.1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("Number\u0009.\u0009POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#1: Number\\u0009.\\u0009POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#2 +if (eval("Number\u000B.\u000BPOSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#2: Number\\u000B.\\u000BPOSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#3 +if (eval("Number\u000C.\u000CPOSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#3: Number\\u000C.\\u000CPOSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#4 +if (eval("Number\u0020.\u0020POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#4: Number\\u0020.\\u0020POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#5 +if (eval("Number\u00A0.\u00A0POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#5: Number\\u00A0.\\u00A0POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#6 +if (eval("Number\u000A.\u000APOSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#6: Number\\u000A.\\u000APOSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#7 +if (eval("Number\u000D.\u000DPOSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#7: Number\\u000D.\\u000DPOSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#8 +if (eval("Number\u2028.\u2028POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#8: Number\\u2028.\\u2028POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#9 +if (eval("Number\u2029.\u2029POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#9: Number\\u2029.\\u2029POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#10 +if (eval("Number\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029.\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + $ERROR('#10: Number\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029.\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A1.2.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A1.2.js new file mode 100644 index 000000000..a820dbd5d --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A1.2.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 between "[" and MemberExpression or CallExpression and between Identifier and "]" are allowed + * + * @path ch11/11.2/11.2.1/S11.2.1_A1.2.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval('Number[\u0009"POSITIVE_INFINITY"\u0009]') !== Number.POSITIVE_INFINITY) { + $ERROR('#1: Number[\\u0009"POSITIVE_INFINITY"\\u0009] === Number.POSITIVE_INFINITY'); +} + +//CHECK#2 +if (eval('Number[\u000B"POSITIVE_INFINITY"\u000B]') !== Number.POSITIVE_INFINITY) { + $ERROR('#2: Number[\\u000B"POSITIVE_INFINITY"\\u000B] === Number.POSITIVE_INFINITY'); +} + +//CHECK#3 +if (eval('Number[\u000C"POSITIVE_INFINITY"\u000C]') !== Number.POSITIVE_INFINITY) { + $ERROR('#3: Number[\\u000C"POSITIVE_INFINITY"\\u000C] === Number.POSITIVE_INFINITY'); +} + +//CHECK#4 +if (eval('Number[\u0020"POSITIVE_INFINITY"\u0020]') !== Number.POSITIVE_INFINITY) { + $ERROR('#4: Number[\\u0020"POSITIVE_INFINITY"\\u0020] === Number.POSITIVE_INFINITY'); +} + +//CHECK#5 +if (eval('Number[\u00A0"POSITIVE_INFINITY"\u00A0]') !== Number.POSITIVE_INFINITY) { + $ERROR('#5: Number[\\u00A0"POSITIVE_INFINITY"\\u00A0] === Number.POSITIVE_INFINITY'); +} + +//CHECK#6 +if (eval('Number[\u000A"POSITIVE_INFINITY"\u000A]') !== Number.POSITIVE_INFINITY) { + $ERROR('#6: Number[\\u000A"POSITIVE_INFINITY"\\u000A] === Number.POSITIVE_INFINITY'); +} + +//CHECK#7 +if (eval('Number[\u000D"POSITIVE_INFINITY"\u000D]') !== Number.POSITIVE_INFINITY) { + $ERROR('#7: Number[\\u000D"POSITIVE_INFINITY"\\u000D] === Number.POSITIVE_INFINITY'); +} + +//CHECK#8 +if (eval('Number[\u2028"POSITIVE_INFINITY"\u2028]') !== Number.POSITIVE_INFINITY) { + $ERROR('#8: Number[\\u2028"POSITIVE_INFINITY"\\u2028] === Number.POSITIVE_INFINITY'); +} + +//CHECK#9 +if (eval('Number[\u2029"POSITIVE_INFINITY"\u2029]') !== Number.POSITIVE_INFINITY) { + $ERROR('#9: Number[\\u2029"POSITIVE_INFINITY"\\u2029] === Number.POSITIVE_INFINITY'); +} + +//CHECK#10 +if (eval('Number[\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029"POSITIVE_INFINITY"\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029]') !== Number.POSITIVE_INFINITY) { + $ERROR('#10: Number[\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029"POSITIVE_INFINITY"\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029] === Number.POSITIVE_INFINITY'); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A2.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A2.js new file mode 100644 index 000000000..1237eae5e --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A2.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. + +/** + * MemberExpression and CallExpression uses GetValue + * + * @path ch11/11.2/11.2.1/S11.2.1_A2.js + * @description If GetBase(MemberExpression or CallExpression) is null, throw ReferenceError + */ + +//CHECK#1 +try { + object[1]; + $ERROR('#1.1: object[1] throw ReferenceError. Actual: ' + (object[1])); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: object[1] throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + object.prop; + $ERROR('#2.1: object.prop throw ReferenceError. Actual: ' + (object.prop)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#2.2: object.prop throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T1.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T1.js new file mode 100644 index 000000000..a13f25e7b --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * MemberExpression calls ToObject(MemberExpression) and ToString(Expression). CallExpression calls ToObject(CallExpression) and ToString(Expression) + * + * @path ch11/11.2/11.2.1/S11.2.1_A3_T1.js + * @description Checking Boolean case + */ + +//CHECK#1 +if (true.toString() !== "true") { + $ERROR('#1: true.toString() === "true". Actual: ' + (true.toString())); +} + +//CHECK#2 +if (false["toString"]() !== "false") { + $ERROR('#2: false["toString"]() === "false". Actual: ' + (false["toString"]())); +} + +//CHECK#3 +if (new Boolean(true).toString() !== "true") { + $ERROR('#3: new Boolean(true).toString() === "true". Actual: ' + (new Boolean(true).toString())); +} + +//CHECK#4 +if (new Boolean(false)["toString"]() !== "false") { + $ERROR('#4: new Boolean(false)["toString"]() === "false". Actual: ' + (new Boolean(false)["toString"]())); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T2.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T2.js new file mode 100644 index 000000000..defe6a8c8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * MemberExpression calls ToObject(MemberExpression) and ToString(Expression). CallExpression calls ToObject(CallExpression) and ToString(Expression) + * + * @path ch11/11.2/11.2.1/S11.2.1_A3_T2.js + * @description Checking Number case + */ + +//CHECK#1 +if (1..toString() !== "1") { + $ERROR('#1: 1..toString() === "1". Actual: ' + (1..toString())); +} + +//CHECK#2 +if (1.1.toFixed(5) !== "1.10000") { + $ERROR('#2: 1.1.toFixed(5) === "1.10000". Actual: ' + (1.1.toFixed(5))); +} + +//CHECK#3 +if (1["toString"]() !== "1") { + $ERROR('#3: 1["toString"]() === "1". Actual: ' + (1["toString"]())); +} + +//CHECK#4 +if (1.["toFixed"](5) !== "1.00000") { + $ERROR('#4: 1.["toFixed"](5) === "1.00000". Actual: ' + (1.["toFixed"](5))); +} + +//CHECK#5 +if (new Number(1).toString() !== "1") { + $ERROR('#5: new Number(1).toString() === "1". Actual: ' + (new Number(1).toString())); +} + +//CHECK#6 +if (new Number(1)["toFixed"](5) !== "1.00000") { + $ERROR('#6: new Number(1)["toFixed"](5) === "1.00000". Actual: ' + (new Number(1)["toFixed"](5))); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T3.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T3.js new file mode 100644 index 000000000..14a0e85e3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * MemberExpression calls ToObject(MemberExpression) and ToString(Expression). CallExpression calls ToObject(CallExpression) and ToString(Expression) + * + * @path ch11/11.2/11.2.1/S11.2.1_A3_T3.js + * @description Checking String case; + */ + +//CHECK#1 +if ("abc123".charAt(5) !== "3") { + $ERROR('#1: "abc123".charAt(5) === "3". Actual: ' + ("abc123".charAt(5))); +} + +//CHECK#2 +if ("abc123"["charAt"](0) !== "a") { + $ERROR('#2: "abc123"["charAt"](0) === "a". Actual: ' + ("abc123"["charAt"](0))); +} + +//CHECK#3 +if ("abc123".length !== 6) { + $ERROR('#3: "abc123".length === 6. Actual: ' + ("abc123".length)); +} + +//CHECK#4 +if ("abc123"["length"] !== 6) { + $ERROR('#4: "abc123"["length"] === 6. Actual: ' + ("abc123"["length"])); +} + +//CHECK#5 +if (new String("abc123").length !== 6) { + $ERROR('#5: new String("abc123").length === 6. Actual: ' + (new String("abc123").length)); +} + +//CHECK#6 +if (new String("abc123")["charAt"](2) !== "c") { + $ERROR('#6: new String("abc123")["charAt"](2) === "c". Actual: ' + (new String("abc123")["charAt"](2))); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T4.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T4.js new file mode 100644 index 000000000..2c360c65d --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T4.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. + +/** + * MemberExpression calls ToObject(MemberExpression) and ToString(Expression). CallExpression calls ToObject(CallExpression) and ToString(Expression) + * + * @path ch11/11.2/11.2.1/S11.2.1_A3_T4.js + * @description Checking "undefined" case + */ + +//CHECK#1 +try { + undefined.toString(); + $ERROR('#1.1: undefined.toString() throw TypeError. Actual: ' + (undefined.toString())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: undefined.toString() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + undefined["toString"](); + $ERROR('#2.1: undefined["toString"]() throw TypeError. Actual: ' + (undefined["toString"]())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: undefined["toString"]() throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T5.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T5.js new file mode 100644 index 000000000..405415f72 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A3_T5.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. + +/** + * MemberExpression calls ToObject(MemberExpression) and ToString(Expression). CallExpression calls ToObject(CallExpression) and ToString(Expression) + * + * @path ch11/11.2/11.2.1/S11.2.1_A3_T5.js + * @description Checking "null" case + */ + +//CHECK#1 +try { + null.toString(); + $ERROR('#1.1: null.toString() throw TypeError. Actual: ' + (null.toString())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: null.toString() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + null["toString"](); + $ERROR('#2.1: null["toString"]() throw TypeError. Actual: ' + (null["toString"]())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: null["toString"]() throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T1.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T1.js new file mode 100644 index 000000000..8f9212243 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T1.js + * @description Checking properties of this object + */ + +//CHECK#1-32 +if (typeof (this.NaN) === "undefined") $ERROR('#1: typeof (this.NaN) !== "undefined"'); +if (typeof this['NaN'] === "undefined") $ERROR('#2: typeof this["NaN"] !== "undefined"'); +if (typeof this.Infinity === "undefined") $ERROR('#3: typeof this.Infinity !== "undefined"'); +if (typeof this['Infinity'] === "undefined") $ERROR('#4: typeof this["Infinity"] !== "undefined"'); +if (typeof this.parseInt === "undefined") $ERROR('#5: typeof this.parseInt !== "undefined"'); +if (typeof this['parseInt'] === "undefined") $ERROR('#6: typeof this["parseInt"] !== "undefined"'); +if (typeof this.parseFloat === "undefined") $ERROR('#7: typeof this.parseFloat !== "undefined"'); +if (typeof this['parseFloat'] === "undefined") $ERROR('#8: typeof this["parseFloat"] !== "undefined"'); +if (typeof this.isNaN === "undefined") $ERROR('#13: typeof this.isNaN !== "undefined"'); +if (typeof this['isNaN'] === "undefined") $ERROR('#14: typeof this["isNaN"] !== "undefined"'); +if (typeof this.isFinite === "undefined") $ERROR('#15: typeof this.isFinite !== "undefined"'); +if (typeof this['isFinite'] === "undefined") $ERROR('#16: typeof this["isFinite"] !== "undefined"'); +if (typeof this.Object === "undefined") $ERROR('#17: typeof this.Object !== "undefined"'); +if (typeof this['Object'] === "undefined") $ERROR('#18: typeof this["Object"] !== "undefined"'); +if (typeof this.Number === "undefined") $ERROR('#19: typeof this.Number !== "undefined"'); +if (typeof this['Number'] === "undefined") $ERROR('#20: typeof this["Number"] !== "undefined"'); +if (typeof this.Function === "undefined") $ERROR('#21: typeof this.Function !== "undefined"'); +if (typeof this['Function'] === "undefined") $ERROR('#22: typeof this["Function"] !== "undefined"'); +if (typeof this.Array === "undefined") $ERROR('#23: typeof this.Array !== "undefined"'); +if (typeof this['Array'] === "undefined") $ERROR('#24: typeof this["Array"] !== "undefined"'); +if (typeof this.String === "undefined") $ERROR('#25: typeof this.String !== "undefined"'); +if (typeof this['String'] === "undefined") $ERROR('#26: typeof this["String"] !== "undefined"'); +if (typeof this.Boolean === "undefined") $ERROR('#27: typeof this.Boolean !== "undefined"'); +if (typeof this['Boolean'] === "undefined") $ERROR('#28: typeof this["Boolean"] !== "undefined"'); +if (typeof this.Date === "undefined") $ERROR('#29: typeof this.Date !== "undefined"'); +if (typeof this['Date'] === "undefined") $ERROR('#30: typeof this["Date"] !== "undefined"'); +if (typeof this.Math === "undefined") $ERROR('#31: typeof this.Math !== "undefined"'); +if (typeof this['Math'] === "undefined") $ERROR('#32: typeof this["Math"] !== "undefined"'); + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T2.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T2.js new file mode 100644 index 000000000..ed27f8534 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T2.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. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T2.js + * @description Checking properties and methods of Object objects + */ + +//CHECK#1-8 +if (typeof Object.prototype !== "object") $ERROR('#1: typeof Object.prototype === "object". Actual: ' + (typeof Object.prototype )); +if (typeof Object['prototype'] !== "object") $ERROR('#2: typeof Object["prototype"] === "object". Actual: ' + (typeof Object["prototype"] )); +if (typeof Object.toString !== "function") $ERROR('#3: typeof Object.toString === "function". Actual: ' + (typeof Object.toString )); +if (typeof Object['toString'] !== "function") $ERROR('#4: typeof Object["toString"] === "function". Actual: ' + (typeof Object["toString"] )); +if (typeof Object.valueOf !== "function") $ERROR('#5: typeof Object.valueOf === "function". Actual: ' + (typeof Object.valueOf )); +if (typeof Object['valueOf'] !== "function") $ERROR('#6: typeof Object["valueOf"] === "function". Actual: ' + (typeof Object["valueOf"] )); +if (typeof Object.constructor !== "function") $ERROR('#7: typeof Object.constructor === "function". Actual: ' + (typeof Object.constructor )); +if (typeof Object['constructor'] !== "function") $ERROR('#8: typeof Object["constructor"] === "function". Actual: ' + (typeof Object["constructor"] )); + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T3.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T3.js new file mode 100644 index 000000000..dfa72b139 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T3.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. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T3.js + * @description Checking properties of the Function object + */ + +//CHECK#1-8 +if (typeof Function.prototype !== "function") $ERROR('#1: typeof Function.prototype === "function". Actual: ' + (typeof Function.prototype )); +if (typeof Function['prototype'] !== "function") $ERROR('#2: typeof Function["prototype"] === "function". Actual: ' + (typeof Function["prototype"] )); +if (typeof Function.prototype.toString !== "function") $ERROR('#3: typeof Function.prototype.toString === "function". Actual: ' + (typeof Function.prototype.toString )); +if (typeof Function.prototype['toString'] !== "function") $ERROR('#4: typeof Function.prototype["toString"] === "function". Actual: ' + (typeof Function.prototype["toString"] )); +if (typeof Function.prototype.length !== "number") $ERROR('#5: typeof Function.prototype.length === "number". Actual: ' + (typeof Function.prototype.length )); +if (typeof Function.prototype['length'] !== "number") $ERROR('#6: typeof Function.prototype["length"] === "number". Actual: ' + (typeof Function.prototype["length"] )); +if (typeof Function.prototype.valueOf !== "function") $ERROR('#7: typeof Function.prototype.valueOf === "function". Actual: ' + (typeof Function.prototype.valueOf )); +if (typeof Function.prototype['valueOf'] !== "function") $ERROR('#8: typeof Function.prototype["valueOf"] === "function". Actual: ' + (typeof Function.prototype["valueOf"] )); + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T4.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T4.js new file mode 100644 index 000000000..da4633fe2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_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. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T4.js + * @description Checking properties of the Array object + */ + +//CHECK#1-8 +if (typeof Array.prototype !== "object") $ERROR('#1: typeof Array.prototype === "object". Actual: ' + (typeof Array.prototype )); +if (typeof Array['prototype'] !== "object") $ERROR('#2: typeof Array["prototype"] === "object". Actual: ' + (typeof Array["prototype"] )); +if (typeof Array.length !== "number") $ERROR('#3: typeof Array.length === "number". Actual: ' + (typeof Array.length )); +if (typeof Array['length'] !== "number") $ERROR('#4: typeof Array["length"] === "number". Actual: ' + (typeof Array["length"] )); +if (typeof Array.prototype.constructor !== "function") $ERROR('#5: typeof Array.prototype.constructor === "function". Actual: ' + (typeof Array.prototype.constructor )); +if (typeof Array.prototype['constructor'] !== "function") $ERROR('#6: typeof Array.prototype["constructor"] === "function". Actual: ' + (typeof Array.prototype["constructor"] )); +if (typeof Array.prototype.toString !== "function") $ERROR('#7: typeof Array.prototype.toString === "function". Actual: ' + (typeof Array.prototype.toString )); +if (typeof Array.prototype['toString'] !== "function") $ERROR('#8: typeof Array.prototype["toString"] === "function". Actual: ' + (typeof Array.prototype["toString"] )); +if (typeof Array.prototype.join !== "function") $ERROR('#9: typeof Array.prototype.join === "function". Actual: ' + (typeof Array.prototype.join )); +if (typeof Array.prototype['join'] !== "function") $ERROR('#10: typeof Array.prototype["join"] === "function". Actual: ' + (typeof Array.prototype["join"] )); +if (typeof Array.prototype.reverse !== "function") $ERROR('#11: typeof Array.prototype.reverse === "function". Actual: ' + (typeof Array.prototype.reverse )); +if (typeof Array.prototype['reverse'] !== "function") $ERROR('#12: typeof Array.prototype["reverse"] === "function". Actual: ' + (typeof Array.prototype["reverse"] )); +if (typeof Array.prototype.sort !== "function") $ERROR('#13: typeof Array.prototype.sort === "function". Actual: ' + (typeof Array.prototype.sort )); +if (typeof Array.prototype['sort'] !== "function") $ERROR('#14: typeof Array.prototype["sort"] === "function". Actual: ' + (typeof Array.prototype["sort"] )); + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T5.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T5.js new file mode 100644 index 000000000..02904c0b4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T5.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T5.js + * @description Checking properties of the String object + */ + +//CHECK#1-28 +if (typeof String.prototype !== "object") $ERROR('#1: typeof String.prototype === "object". Actual: ' + (typeof String.prototype )); +if (typeof String['prototype'] !== "object") $ERROR('#2: typeof String["prototype"] === "object". Actual: ' + (typeof String["prototype"] )); +if (typeof String.fromCharCode !== "function") $ERROR('#3: typeof String.fromCharCode === "function". Actual: ' + (typeof String.fromCharCode )); +if (typeof String['fromCharCode'] !== "function") $ERROR('#4: typeof String["fromCharCode"] === "function". Actual: ' + (typeof String["fromCharCode"] )); +if (typeof String.prototype.toString !== "function") $ERROR('#5: typeof String.prototype.toString === "function". Actual: ' + (typeof String.prototype.toString )); +if (typeof String.prototype['toString'] !== "function") $ERROR('#6: typeof String.prototype["toString"] === "function". Actual: ' + (typeof String.prototype["toString"] )); +if (typeof String.prototype.constructor !== "function") $ERROR('#7: typeof String.prototype.constructor === "function". Actual: ' + (typeof String.prototype.constructor )); +if (typeof String.prototype['constructor'] !== "function") $ERROR('#8: typeof String.prototype["constructor"] === "function". Actual: ' + (typeof String.prototype["constructor"] )); +if (typeof String.prototype.valueOf !== "function") $ERROR('#9: typeof String.prototype.valueOf === "function". Actual: ' + (typeof String.prototype.valueOf )); +if (typeof String.prototype['valueOf'] !== "function") $ERROR('#10: typeof String.prototype["valueOf"] === "function". Actual: ' + (typeof String.prototype["valueOf"] )); +if (typeof String.prototype.charAt !== "function") $ERROR('#11: typeof String.prototype.charAt === "function". Actual: ' + (typeof String.prototype.charAt )); +if (typeof String.prototype['charAt'] !== "function") $ERROR('#12: typeof String.prototype["charAt"] === "function". Actual: ' + (typeof String.prototype["charAt"] )); +if (typeof String.prototype.charCodeAt !== "function") $ERROR('#13: typeof String.prototype.charCodeAt === "function". Actual: ' + (typeof String.prototype.charCodeAt )); +if (typeof String.prototype['charCodeAt'] !== "function") $ERROR('#14: typeof String.prototype["charCodeAt"] === "function". Actual: ' + (typeof String.prototype["charCodeAt"] )); +if (typeof String.prototype.indexOf !== "function") $ERROR('#15: typeof String.prototype.indexOf === "function". Actual: ' + (typeof String.prototype.indexOf )); +if (typeof String.prototype['indexOf'] !== "function") $ERROR('#16: typeof String.prototype["indexOf"] === "function". Actual: ' + (typeof String.prototype["indexOf"] )); +if (typeof String.prototype.lastIndexOf !== "function") $ERROR('#17: typeof String.prototype.lastIndexOf === "function". Actual: ' + (typeof String.prototype.lastIndexOf )); +if (typeof String.prototype['lastIndexOf'] !== "function") $ERROR('#18: typeof String.prototype["lastIndexOf"] === "function". Actual: ' + (typeof String.prototype["lastIndexOf"] )); +if (typeof String.prototype.split !== "function") $ERROR('#19: typeof String.prototype.split === "function". Actual: ' + (typeof String.prototype.split )); +if (typeof String.prototype['split'] !== "function") $ERROR('#20: typeof String.prototype["split"] === "function". Actual: ' + (typeof String.prototype["split"] )); +if (typeof String.prototype.substring !== "function") $ERROR('#21: typeof String.prototype.substring === "function". Actual: ' + (typeof String.prototype.substring )); +if (typeof String.prototype['substring'] !== "function") $ERROR('#22: typeof String.prototype["substring"] === "function". Actual: ' + (typeof String.prototype["substring"] )); +if (typeof String.prototype.toLowerCase !== "function") $ERROR('#23: typeof String.prototype.toLowerCase === "function". Actual: ' + (typeof String.prototype.toLowerCase )); +if (typeof String.prototype['toLowerCase'] !== "function") $ERROR('#24: typeof String.prototype["toLowerCase"] === "function". Actual: ' + (typeof String.prototype["toLowerCase"] )); +if (typeof String.prototype.toUpperCase !== "function") $ERROR('#25: typeof String.prototype.toUpperCase === "function". Actual: ' + (typeof String.prototype.toUpperCase )); +if (typeof String.prototype['toUpperCase'] !== "function") $ERROR('#26: typeof Array.prototype === "object". Actual: ' + (typeof Array.prototype )); +if (typeof String.prototype.length !== "number") $ERROR('#27: typeof String.prototype.length === "number". Actual: ' + (typeof String.prototype.length )); +if (typeof String.prototype['length'] !== "number") $ERROR('#28: typeof String.prototype["length"] === "number". Actual: ' + (typeof String.prototype["length"] )); + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T6.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T6.js new file mode 100644 index 000000000..0d8668846 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T6.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. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T6.js + * @description Checking properties of the Boolean object + */ + +//CHECK#1-8 +if (typeof Boolean.prototype !== "object") $ERROR('#1: typeof Boolean.prototype === "object". Actual: ' + (typeof Boolean.prototype )); +if (typeof Boolean['prototype'] !== "object") $ERROR('#2: typeof Boolean["prototype"] === "object". Actual: ' + (typeof Boolean["prototype"] )); +if (typeof Boolean.constructor !== "function") $ERROR('#3: typeof Boolean.constructor === "function". Actual: ' + (typeof Boolean.constructor )); +if (typeof Boolean['constructor'] !== "function") $ERROR('#4: typeof Boolean["constructor"] === "function". Actual: ' + (typeof Boolean["constructor"] )); +if (typeof Boolean.prototype.valueOf !== "function") $ERROR('#5: typeof Boolean.prototype.valueOf === "function". Actual: ' + (typeof Boolean.prototype.valueOf )); +if (typeof Boolean.prototype['valueOf'] !== "function") $ERROR('#6: typeof Boolean.prototype["valueOf"] === "function". Actual: ' + (typeof Boolean.prototype["valueOf"] )); +if (typeof Boolean.prototype.toString !== "function") $ERROR('#7: typeof Boolean.prototype.toString === "function". Actual: ' + (typeof Boolean.prototype.toString )); +if (typeof Boolean.prototype['toString'] !== "function") $ERROR('#8: typeof Boolean.prototype["toString"] === "function". Actual: ' + (typeof Boolean.prototype["toString"] )); + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T7.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T7.js new file mode 100644 index 000000000..7d8826d80 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T7.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T7.js + * @description Checking properties of the Number object + */ + +//CHECK#1-16 +if (typeof Number.MAX_VALUE !== "number") $ERROR('#1: typeof Number.MAX_VALUE === "number". Actual: ' + (typeof Number.MAX_VALUE )); +if (typeof Number['MAX_VALUE'] !== "number") $ERROR('#2: typeof Number["MAX_VALUE"] === "number". Actual: ' + (typeof Number["MAX_VALUE"] )); +if (typeof Number.MIN_VALUE !== "number") $ERROR('#3: typeof Number.MIN_VALUE === "number". Actual: ' + (typeof Number.MIN_VALUE )); +if (typeof Number['MIN_VALUE'] !== "number") $ERROR('#4: typeof Number["MIN_VALUE"] === "number". Actual: ' + (typeof Number["MIN_VALUE"] )); +if (typeof Number.NaN !== "number") $ERROR('#5: typeof Number.NaN === "number". Actual: ' + (typeof Number.NaN )); +if (typeof Number['NaN'] !== "number") $ERROR('#6: typeof Number["NaN"] === "number". Actual: ' + (typeof Number["NaN"] )); +if (typeof Number.NEGATIVE_INFINITY !== "number") $ERROR('#7: typeof Number.NEGATIVE_INFINITY === "number". Actual: ' + (typeof Number.NEGATIVE_INFINITY )); +if (typeof Number['NEGATIVE_INFINITY'] !== "number") $ERROR('#8: typeof Number["NEGATIVE_INFINITY"] === "number". Actual: ' + (typeof Number["NEGATIVE_INFINITY"] )); +if (typeof Number.POSITIVE_INFINITY !== "number") $ERROR('#9: typeof Number.POSITIVE_INFINITY === "number". Actual: ' + (typeof Number.POSITIVE_INFINITY )); +if (typeof Number['POSITIVE_INFINITY'] !== "number") $ERROR('#10: typeof Number["POSITIVE_INFINITY"] === "number". Actual: ' + (typeof Number["POSITIVE_INFINITY"] )); +if (typeof Number.prototype.toString !== "function") $ERROR('#11: typeof Number.prototype.toString === "function". Actual: ' + (typeof Number.prototype.toString )); +if (typeof Number.prototype['toString'] !== "function") $ERROR('#12: typeof Number.prototype["toString"] === "function". Actual: ' + (typeof Number.prototype["toString"] )); +if (typeof Number.prototype.constructor !== "function") $ERROR('#13: typeof Number.prototype.constructor === "function". Actual: ' + (typeof Number.prototype.constructor )); +if (typeof Number.prototype['constructor'] !== "function") $ERROR('#14: typeof Number.prototype["constructor"] === "function". Actual: ' + (typeof Number.prototype["constructor"] )); +if (typeof Number.prototype.valueOf !== "function") $ERROR('#15: typeof Number.prototype.valueOf === "function". Actual: ' + (typeof Number.prototype.valueOf )); +if (typeof Number.prototype['valueOf'] !== "function") $ERROR('#16: typeof Number.prototype["valueOf"] === "function". Actual: ' + (typeof Number.prototype["valueOf"] )); + + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T8.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T8.js new file mode 100644 index 000000000..fd3846e9c --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T8.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. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T8.js + * @description Checking properties of the Math Object + */ + +//CHECK#1-52 +if (typeof Math.E !== "number") $ERROR('#1: typeof Math.E === "number". Actual: ' + (typeof Math.E )); +if (typeof Math['E'] !== "number") $ERROR('#2: typeof Math["E"] === "number". Actual: ' + (typeof Math["E"] )); +if (typeof Math.LN10 !== "number") $ERROR('#3: typeof Math.LN10 === "number". Actual: ' + (typeof Math.LN10 )); +if (typeof Math['LN10'] !== "number") $ERROR('#4: typeof Math["LN10"] === "number". Actual: ' + (typeof Math["LN10"] )); +if (typeof Math.LN2 !== "number") $ERROR('#5: typeof Math.LN2 === "number". Actual: ' + (typeof Math.LN2 )); +if (typeof Math['LN2'] !== "number") $ERROR('#6: typeof Math["LN2"] === "number". Actual: ' + (typeof Math["LN2"] )); +if (typeof Math.LOG2E !== "number") $ERROR('#7: typeof Math.LOG2E === "number". Actual: ' + (typeof Math.LOG2E )); +if (typeof Math['LOG2E'] !== "number") $ERROR('#8: typeof Math["LOG2E"] === "number". Actual: ' + (typeof Math["LOG2E"] )); +if (typeof Math.LOG10E !== "number") $ERROR('#9: typeof Math.LOG10E === "number". Actual: ' + (typeof Math.LOG10E )); +if (typeof Math['LOG10E'] !== "number") $ERROR('#10: typeof Math["LOG10E"] === "number". Actual: ' + (typeof Math["LOG10E"] )); +if (typeof Math.PI !== "number") $ERROR('#11: typeof Math.PI === "number". Actual: ' + (typeof Math.PI )); +if (typeof Math['PI'] !== "number") $ERROR('#12: typeof Math["PI"] === "number". Actual: ' + (typeof Math["PI"] )); +if (typeof Math.SQRT1_2 !== "number") $ERROR('#13: typeof Math.SQRT1_2 === "number". Actual: ' + (typeof Math.SQRT1_2 )); +if (typeof Math['SQRT1_2'] !== "number") $ERROR('#14: typeof Math["SQRT1_2"] === "number". Actual: ' + (typeof Math["SQRT1_2"] )); +if (typeof Math.SQRT2 !== "number") $ERROR('#15: typeof Math.SQRT2 === "number". Actual: ' + (typeof Math.SQRT2 )); +if (typeof Math['SQRT2'] !== "number") $ERROR('#16: typeof Math["SQRT2"] === "number". Actual: ' + (typeof Math["SQRT2"] )); +if (typeof Math.abs !== "function") $ERROR('#17: typeof Math.abs === "function". Actual: ' + (typeof Math.abs )); +if (typeof Math['abs'] !== "function") $ERROR('#18: typeof Math["abs"] === "function". Actual: ' + (typeof Math["abs"] )); +if (typeof Math.acos !== "function") $ERROR('#19: typeof Math.acos === "function". Actual: ' + (typeof Math.acos )); +if (typeof Math['acos'] !== "function") $ERROR('#20: typeof Math["acos"] === "function". Actual: ' + (typeof Math["acos"] )); +if (typeof Math.asin !== "function") $ERROR('#21: typeof Math.asin === "function". Actual: ' + (typeof Math.asin )); +if (typeof Math['asin'] !== "function") $ERROR('#22: typeof Math["asin"] === "function". Actual: ' + (typeof Math["asin"] )); +if (typeof Math.atan !== "function") $ERROR('#23: typeof Math.atan === "function". Actual: ' + (typeof Math.atan )); +if (typeof Math['atan'] !== "function") $ERROR('#24: typeof Math["atan"] === "function". Actual: ' + (typeof Math["atan"] )); +if (typeof Math.atan2 !== "function") $ERROR('#25: typeof Math.atan2 === "function". Actual: ' + (typeof Math.atan2 )); +if (typeof Math['atan2'] !== "function") $ERROR('#26: typeof Math["atan2"] === "function". Actual: ' + (typeof Math["atan2"] )); +if (typeof Math.ceil !== "function") $ERROR('#27: typeof Math.ceil === "function". Actual: ' + (typeof Math.ceil )); +if (typeof Math['ceil'] !== "function") $ERROR('#28: typeof Math["ceil"] === "function". Actual: ' + (typeof Math["ceil"] )); +if (typeof Math.cos !== "function") $ERROR('#29: typeof Math.cos === "function". Actual: ' + (typeof Math.cos )); +if (typeof Math['cos'] !== "function") $ERROR('#30: typeof Math["cos"] === "function". Actual: ' + (typeof Math["cos"] )); +if (typeof Math.exp !== "function") $ERROR('#31: typeof Math.exp === "function". Actual: ' + (typeof Math.exp )); +if (typeof Math['exp'] !== "function") $ERROR('#32: typeof Math["exp"] === "function". Actual: ' + (typeof Math["exp"] )); +if (typeof Math.floor !== "function") $ERROR('#33: typeof Math.floor === "function". Actual: ' + (typeof Math.floor )); +if (typeof Math['floor'] !== "function") $ERROR('#34: typeof Math["floor"] === "function". Actual: ' + (typeof Math["floor"] )); +if (typeof Math.log !== "function") $ERROR('#35: typeof Math.log === "function". Actual: ' + (typeof Math.log )); +if (typeof Math['log'] !== "function") $ERROR('#36: typeof Math["log"] === "function". Actual: ' + (typeof Math["log"] )); +if (typeof Math.max !== "function") $ERROR('#37: typeof Math.max === "function". Actual: ' + (typeof Math.max )); +if (typeof Math['max'] !== "function") $ERROR('#38: typeof Math["max"] === "function". Actual: ' + (typeof Math["max"] )); +if (typeof Math.min !== "function") $ERROR('#39: typeof Math.min === "function". Actual: ' + (typeof Math.min )); +if (typeof Math['min'] !== "function") $ERROR('#40: typeof Math["min"] === "function". Actual: ' + (typeof Math["min"] )); +if (typeof Math.pow !== "function") $ERROR('#41: typeof Math.pow === "function". Actual: ' + (typeof Math.pow )); +if (typeof Math['pow'] !== "function") $ERROR('#42: typeof Math["pow"] === "function". Actual: ' + (typeof Math["pow"] )); +if (typeof Math.random !== "function") $ERROR('#43: typeof Math.random === "function". Actual: ' + (typeof Math.random )); +if (typeof Math['random'] !== "function") $ERROR('#44: typeof Math["random"] === "function". Actual: ' + (typeof Math["random"] )); +if (typeof Math.round !== "function") $ERROR('#45: typeof Math.round === "function". Actual: ' + (typeof Math.round )); +if (typeof Math['round'] !== "function") $ERROR('#46: typeof Math["round"] === "function". Actual: ' + (typeof Math["round"] )); +if (typeof Math.sin !== "function") $ERROR('#47: typeof Math.sin === "function". Actual: ' + (typeof Math.sin )); +if (typeof Math['sin'] !== "function") $ERROR('#48: typeof Math["sin"] === "function". Actual: ' + (typeof Math["sin"] )); +if (typeof Math.sqrt !== "function") $ERROR('#49: typeof Math.sqrt === "function". Actual: ' + (typeof Math.sqrt )); +if (typeof Math['sqrt'] !== "function") $ERROR('#50: typeof Math["sqrt"] === "function". Actual: ' + (typeof Math["sqrt"] )); +if (typeof Math.tan !== "function") $ERROR('#51: typeof Math.tan === "function". Actual: ' + (typeof Math.tan )); +if (typeof Math['tan'] !== "function") $ERROR('#52: typeof Math["tan"] === "function". Actual: ' + (typeof Math["tan"] )); + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T9.js b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T9.js new file mode 100644 index 000000000..409d49e58 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/S11.2.1_A4_T9.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. + +/** + * Check type of various properties + * + * @path ch11/11.2/11.2.1/S11.2.1_A4_T9.js + * @description Checking properties of the Date object + */ + +//CHECK#1-86 +if (typeof Date.parse !== "function") $ERROR('#1: typeof Date.parse === "function". Actual: ' + (typeof Date.parse )); +if (typeof Date['parse'] !== "function") $ERROR('#2: typeof Date["parse"] === "function". Actual: ' + (typeof Date["parse"] )); +if (typeof Date.prototype !== "object") $ERROR('#3: typeof Date.prototype === "object". Actual: ' + (typeof Date.prototype )); +if (typeof Date['prototype'] !== "object") $ERROR('#4: typeof Date["prototype"] === "object". Actual: ' + (typeof Date["prototype"] )); +if (typeof Date.UTC !== "function") $ERROR('#5: typeof Date.UTC === "function". Actual: ' + (typeof Date.UTC )); +if (typeof Date['UTC'] !== "function") $ERROR('#6: typeof Date["UTC"] === "function". Actual: ' + (typeof Date["UTC"] )); +if (typeof Date.prototype.constructor !== "function") $ERROR('#7: typeof Date.prototype.constructor === "funvtion". Actual: ' + (typeof Date.prototype.constructor )); +if (typeof Date.prototype['constructor'] !== "function") $ERROR('#8: typeof Date.prototype["constructor"] === "function". Actual: ' + (typeof Date.prototype["constructor"] )); +if (typeof Date.prototype.toString !== "function") $ERROR('#9: typeof Date.prototype.toString === "function". Actual: ' + (typeof Date.prototype.toString )); +if (typeof Date.prototype['toString'] !== "function") $ERROR('#10: typeof Date.prototype["toString"] === "function". Actual: ' + (typeof Date.prototype["toString"] )); +if (typeof Date.prototype.valueOf !== "function") $ERROR('#11: typeof Date.prototype.valueOf === "function". Actual: ' + (typeof Date.prototype.valueOf )); +if (typeof Date.prototype['valueOf'] !== "function") $ERROR('#12: typeof Date.prototype["valueOf"] === "function". Actual: ' + (typeof Date.prototype["valueOf"] )); +if (typeof Date.prototype.getTime !== "function") $ERROR('#13: typeof Date.prototype.getTime === "function". Actual: ' + (typeof Date.prototype.getTime )); +if (typeof Date.prototype['getTime'] !== "function") $ERROR('#14: typeof Date.prototype["getTime"] === "function". Actual: ' + (typeof Date.prototype["getTime"] )); +if (typeof Date.prototype.getFullYear !== "function") $ERROR('#17: typeof Date.prototype.getFullYear === "function". Actual: ' + (typeof Date.prototype.getFullYear )); +if (typeof Date.prototype['getFullYear'] !== "function") $ERROR('#18: typeof Date.prototype["getFullYear"] === "function". Actual: ' + (typeof Date.prototype["getFullYear"] )); +if (typeof Date.prototype.getUTCFullYear !== "function") $ERROR('#19: typeof Date.prototype.getUTCFullYear === "function". Actual: ' + (typeof Date.prototype.getUTCFullYear )); +if (typeof Date.prototype['getUTCFullYear'] !== "function") $ERROR('#20: typeof Date.prototype["getUTCFullYear"] === "function". Actual: ' + (typeof Date.prototype["getUTCFullYear"] )); +if (typeof Date.prototype.getMonth !== "function") $ERROR('#21: typeof Date.prototype.getMonth === "function". Actual: ' + (typeof Date.prototype.getMonth )); +if (typeof Date.prototype['getMonth'] !== "function") $ERROR('#22: typeof Date.prototype["getMonth"] === "function". Actual: ' + (typeof Date.prototype["getMonth"] )); +if (typeof Date.prototype.getUTCMonth !== "function") $ERROR('#23: typeof Date.prototype.getUTCMonth === "function". Actual: ' + (typeof Date.prototype.getUTCMonth )); +if (typeof Date.prototype['getUTCMonth'] !== "function") $ERROR('#24: typeof Date.prototype["getUTCMonth"] === "function". Actual: ' + (typeof Date.prototype["getUTCMonth"] )); +if (typeof Date.prototype.getDate !== "function") $ERROR('#25: typeof Date.prototype.getDate === "function". Actual: ' + (typeof Date.prototype.getDate )); +if (typeof Date.prototype['getDate'] !== "function") $ERROR('#26: typeof Date.prototype["getDate"] === "function". Actual: ' + (typeof Date.prototype["getDate"] )); +if (typeof Date.prototype.getUTCDate !== "function") $ERROR('#27: typeof Date.prototype.getUTCDate === "function". Actual: ' + (typeof Date.prototype.getUTCDate )); +if (typeof Date.prototype['getUTCDate'] !== "function") $ERROR('#28: typeof Date.prototype["getUTCDate"] === "function". Actual: ' + (typeof Date.prototype["getUTCDate"] )); +if (typeof Date.prototype.getDay !== "function") $ERROR('#29: typeof Date.prototype.getDay === "function". Actual: ' + (typeof Date.prototype.getDay )); +if (typeof Date.prototype['getDay'] !== "function") $ERROR('#30: typeof Date.prototype["getDay"] === "function". Actual: ' + (typeof Date.prototype["getDay"] )); +if (typeof Date.prototype.getUTCDay !== "function") $ERROR('#31: typeof Date.prototype.getUTCDay === "function". Actual: ' + (typeof Date.prototype.getUTCDay )); +if (typeof Date.prototype['getUTCDay'] !== "function") $ERROR('#32: typeof Date.prototype["getUTCDay"] === "function". Actual: ' + (typeof Date.prototype["getUTCDay"] )); +if (typeof Date.prototype.getHours !== "function") $ERROR('#33: typeof Date.prototype.getHours === "function". Actual: ' + (typeof Date.prototype.getHours )); +if (typeof Date.prototype['getHours'] !== "function") $ERROR('#34: typeof Date.prototype["getHours"] === "function". Actual: ' + (typeof Date.prototype["getHours"] )); +if (typeof Date.prototype.getUTCHours !== "function") $ERROR('#35: typeof Date.prototype.getUTCHours === "function". Actual: ' + (typeof Date.prototype.getUTCHours )); +if (typeof Date.prototype['getUTCHours'] !== "function") $ERROR('#36: typeof Date.prototype["getUTCHours"] === "function". Actual: ' + (typeof Date.prototype["getUTCHours"] )); +if (typeof Date.prototype.getMinutes !== "function") $ERROR('#37: typeof Date.prototype.getMinutes === "function". Actual: ' + (typeof Date.prototype.getMinutes )); +if (typeof Date.prototype['getMinutes'] !== "function") $ERROR('#38: typeof Date.prototype["getMinutes"] === "function". Actual: ' + (typeof Date.prototype["getMinutes"] )); +if (typeof Date.prototype.getUTCMinutes !== "function") $ERROR('#39: typeof Date.prototype.getUTCMinutes === "function". Actual: ' + (typeof Date.prototype.getUTCMinutes )); +if (typeof Date.prototype['getUTCMinutes'] !== "function") $ERROR('#40: typeof Date.prototype["getUTCMinutes"] === "function". Actual: ' + (typeof Date.prototype["getUTCMinutes"] )); +if (typeof Date.prototype.getSeconds !== "function") $ERROR('#41: typeof Date.prototype.getSeconds === "function". Actual: ' + (typeof Date.prototype.getSeconds )); +if (typeof Date.prototype['getSeconds'] !== "function") $ERROR('#42: typeof Date.prototype["getSeconds"] === "function". Actual: ' + (typeof Date.prototype["getSeconds"] )); +if (typeof Date.prototype.getUTCSeconds !== "function") $ERROR('#43: typeof Date.prototype.getUTCSeconds === "function". Actual: ' + (typeof Date.prototype.getUTCSeconds )); +if (typeof Date.prototype['getUTCSeconds'] !== "function") $ERROR('#44: typeof Date.prototype["getUTCSeconds"] === "function". Actual: ' + (typeof Date.prototype["getUTCSeconds"] )); +if (typeof Date.prototype.getMilliseconds !== "function") $ERROR('#45: typeof Date.prototype.getMilliseconds === "function". Actual: ' + (typeof Date.prototype.getMilliseconds )); +if (typeof Date.prototype['getMilliseconds'] !== "function") $ERROR('#46: typeof Date.prototype["getMilliseconds"] === "function". Actual: ' + (typeof Date.prototype["getMilliseconds"] )); +if (typeof Date.prototype.getUTCMilliseconds !== "function") $ERROR('#47: typeof Date.prototype.getUTCMilliseconds === "function". Actual: ' + (typeof Date.prototype.getUTCMilliseconds )); +if (typeof Date.prototype['getUTCMilliseconds'] !== "function") $ERROR('#48: typeof Date.prototype["getUTCMilliseconds"] === "function". Actual: ' + (typeof Date.prototype["getUTCMilliseconds"] )); +if (typeof Date.prototype.setTime !== "function") $ERROR('#49: typeof Date.prototype.setTime === "function". Actual: ' + (typeof Date.prototype.setTime )); +if (typeof Date.prototype['setTime'] !== "function") $ERROR('#50: typeof Date.prototype["setTime"] === "function". Actual: ' + (typeof Date.prototype["setTime"] )); +if (typeof Date.prototype.setMilliseconds !== "function") $ERROR('#51: typeof Date.prototype.setMilliseconds === "function". Actual: ' + (typeof Date.prototype.setMilliseconds )); +if (typeof Date.prototype['setMilliseconds'] !== "function") $ERROR('#52: typeof Date.prototype["setMilliseconds"] === "function". Actual: ' + (typeof Date.prototype["setMilliseconds"] )); +if (typeof Date.prototype.setUTCMilliseconds !== "function") $ERROR('#53: typeof Date.prototype.setUTCMilliseconds === "function". Actual: ' + (typeof Date.prototype.setUTCMilliseconds )); +if (typeof Date.prototype['setUTCMilliseconds'] !== "function") $ERROR('#54: typeof Date.prototype["setUTCMilliseconds"] === "function". Actual: ' + (typeof Date.prototype["setUTCMilliseconds"] )); +if (typeof Date.prototype.setSeconds !== "function") $ERROR('#55: typeof Date.prototype.setSeconds === "function". Actual: ' + (typeof Date.prototype.setSeconds )); +if (typeof Date.prototype['setSeconds'] !== "function") $ERROR('#56: typeof Date.prototype["setSeconds"] === "function". Actual: ' + (typeof Date.prototype["setSeconds"] )); +if (typeof Date.prototype.setUTCSeconds !== "function") $ERROR('#57: typeof Date.prototype.setUTCSeconds === "function". Actual: ' + (typeof Date.prototype.setUTCSeconds )); +if (typeof Date.prototype['setUTCSeconds'] !== "function") $ERROR('#58: typeof Date.prototype["setUTCSeconds"] === "function". Actual: ' + (typeof Date.prototype["setUTCSeconds"] )); +if (typeof Date.prototype.setMinutes !== "function") $ERROR('#59: typeof Date.prototype.setMinutes === "function". Actual: ' + (typeof Date.prototype.setMinutes )); +if (typeof Date.prototype['setMinutes'] !== "function") $ERROR('#60: typeof Date.prototype["setMinutes"] === "function". Actual: ' + (typeof Date.prototype["setMinutes"] )); +if (typeof Date.prototype.setUTCMinutes !== "function") $ERROR('#61: typeof Date.prototype.setUTCMinutes === "function". Actual: ' + (typeof Date.prototype.setUTCMinutes )); +if (typeof Date.prototype['setUTCMinutes'] !== "function") $ERROR('#62: typeof Date.prototype["setUTCMinutes"] === "function". Actual: ' + (typeof Date.prototype["setUTCMinutes"] )); +if (typeof Date.prototype.setHours !== "function") $ERROR('#63: typeof Date.prototype.setHours === "function". Actual: ' + (typeof Date.prototype.setHours )); +if (typeof Date.prototype['setHours'] !== "function") $ERROR('#64: typeof Date.prototype["setHours"] === "function". Actual: ' + (typeof Date.prototype["setHours"] )); +if (typeof Date.prototype.setUTCHours !== "function") $ERROR('#65: typeof Date.prototype.setUTCHours === "function". Actual: ' + (typeof Date.prototype.setUTCHours )); +if (typeof Date.prototype['setUTCHours'] !== "function") $ERROR('#66: typeof Date.prototype["setUTCHours"] === "function". Actual: ' + (typeof Date.prototype["setUTCHours"] )); +if (typeof Date.prototype.setDate !== "function") $ERROR('#67: typeof Date.prototype.setDate === "function". Actual: ' + (typeof Date.prototype.setDate )); +if (typeof Date.prototype['setDate'] !== "function") $ERROR('#68: typeof Date.prototype["setDate"] === "function". Actual: ' + (typeof Date.prototype["setDate"] )); +if (typeof Date.prototype.setUTCDate !== "function") $ERROR('#69: typeof Date.prototype.setUTCDate === "function". Actual: ' + (typeof Date.prototype.setUTCDate )); +if (typeof Date.prototype['setUTCDate'] !== "function") $ERROR('#70: typeof Date.prototype["setUTCDate"] === "function". Actual: ' + (typeof Date.prototype["setUTCDate"] )); +if (typeof Date.prototype.setMonth !== "function") $ERROR('#71: typeof Date.prototype.setMonth === "function". Actual: ' + (typeof Date.prototype.setMonth )); +if (typeof Date.prototype['setMonth'] !== "function") $ERROR('#72: typeof Date.prototype["setMonth"] === "function". Actual: ' + (typeof Date.prototype["setMonth"] )); +if (typeof Date.prototype.setUTCMonth !== "function") $ERROR('#73: typeof Date.prototype.setUTCMonth === "function". Actual: ' + (typeof Date.prototype.setUTCMonth )); +if (typeof Date.prototype['setUTCMonth'] !== "function") $ERROR('#74: typeof Date.prototype["setUTCMonth"] === "function". Actual: ' + (typeof Date.prototype["setUTCMonth"] )); +if (typeof Date.prototype.setFullYear !== "function") $ERROR('#75: typeof Date.prototype.setFullYear === "function". Actual: ' + (typeof Date.prototype.setFullYear )); +if (typeof Date.prototype['setFullYear'] !== "function") $ERROR('#76: typeof Date.prototype["setFullYear"] === "function". Actual: ' + (typeof Date.prototype["setFullYear"] )); +if (typeof Date.prototype.setUTCFullYear !== "function") $ERROR('#77: typeof Date.prototype.setUTCFullYear === "function". Actual: ' + (typeof Date.prototype.setUTCFullYear )); +if (typeof Date.prototype['setUTCFullYear'] !== "function") $ERROR('#78: typeof Date.prototype["setUTCFullYear"] === "function". Actual: ' + (typeof Date.prototype["setUTCFullYear"] )); +if (typeof Date.prototype.toLocaleString !== "function") $ERROR('#81: typeof Date.prototype.toLocaleString === "function". Actual: ' + (typeof Date.prototype.toLocaleString )); +if (typeof Date.prototype['toLocaleString'] !== "function") $ERROR('#82: typeof Date.prototype["toLocaleString"] === "function". Actual: ' + (typeof Date.prototype["toLocaleString"] )); +if (typeof Date.prototype.toUTCString !== "function") $ERROR('#83: typeof Date.prototype.toUTCString === "function". Actual: ' + (typeof Date.prototype.toUTCString )); +if (typeof Date.prototype['toUTCString'] !== "function") $ERROR('#84: typeof Date.prototype["toUTCString"] === "function". Actual: ' + (typeof Date.prototype["toUTCString"] )); + + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/browser.js b/js/src/tests/test262/ch11/11.2/11.2.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/browser.js diff --git a/js/src/tests/test262/ch11/11.2/11.2.1/shell.js b/js/src/tests/test262/ch11/11.2/11.2.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.1/shell.js diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A1.1.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A1.1.js new file mode 100644 index 000000000..10811b4b0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A1.1.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 between "new" and NewExpression are allowed + * + * @path ch11/11.2/11.2.2/S11.2.2_A1.1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("new\u0009Number") != 0) { + $ERROR('#1: new\\u0009Number == 0'); +} + +//CHECK#2 +if (eval("new\u000BNumber") != 0) { + $ERROR('#2: new\\u000BNumber == 0'); +} + +//CHECK#3 +if (eval("new\u000CNumber") != 0) { + $ERROR('#3: new\\u000CNumber == 0'); +} + +//CHECK#4 +if (eval("new\u0020Number") != 0) { + $ERROR('#4: new\\u0020Number == 0'); +} + +//CHECK#5 +if (eval("new\u00A0Number") != 0) { + $ERROR('#5: new\\u00A0Number == 0'); +} + +//CHECK#6 +if (eval("new\u000ANumber") != 0) { + $ERROR('#6: new\\u000ANumber == 0'); +} + +//CHECK#7 +if (eval("new\u000DNumber") != 0) { + $ERROR('#7: new\\u000DNumber == 0'); +} + +//CHECK#8 +if (eval("new\u2028Number") != 0) { + $ERROR('#8: new\\u2028Number == 0'); +} + +//CHECK#9 +if (eval("new\u2029Number") != 0) { + $ERROR('#9: new\\u2029Number == 0'); +} + +//CHECK#10 +if (eval("new\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Number") != 0) { + $ERROR('#10: new\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number == 0'); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A1.2.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A1.2.js new file mode 100644 index 000000000..d47eb10bf --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A1.2.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 between "new" and MemberExpression are allowed + * + * @path ch11/11.2/11.2.2/S11.2.2_A1.2.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("new\u0009Number()") != 0) { + $ERROR('#1: new\\u0009Number == 0'); +} + +//CHECK#2 +if (eval("new\u000BNumber()") != 0) { + $ERROR('#2: new\\u000BNumber == 0'); +} + +//CHECK#3 +if (eval("new\u000CNumber()") != 0) { + $ERROR('#3: new\\u000CNumber == 0'); +} + +//CHECK#4 +if (eval("new\u0020Number()") != 0) { + $ERROR('#4: new\\u0020Number == 0'); +} + +//CHECK#5 +if (eval("new\u00A0Number()") != 0) { + $ERROR('#5: new\\u00A0Number == 0'); +} + +//CHECK#6 +if (eval("new\u000ANumber()") != 0) { + $ERROR('#6: new\\u000ANumber == 0'); +} + +//CHECK#7 +if (eval("new\u000DNumber()") != 0) { + $ERROR('#7: new\\u000DNumber == 0'); +} + +//CHECK#8 +if (eval("new\u2028Number()") != 0) { + $ERROR('#8: new\\u2028Number == 0'); +} + +//CHECK#9 +if (eval("new\u2029Number()") != 0) { + $ERROR('#9: new\\u2029Number == 0'); +} + +//CHECK#10 +if (eval("new\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Number()") != 0) { + $ERROR('#10: new\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number == 0'); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A2.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A2.js new file mode 100644 index 000000000..e879390fc --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A2.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. + +/** + * Operator "new" uses GetValue + * + * @path ch11/11.2/11.2.2/S11.2.2_A2.js + * @description If GetBase(NewExpression) or GetBase(MemberExpression) is null, throw ReferenceError + */ + +//CHECK#1 +try { + new x; + $ERROR('#1.1: new x throw ReferenceError. Actual: ' + (new x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: new x throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + new x(); + $ERROR('#2: new x() throw ReferenceError'); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#2: new x() throw ReferenceError'); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T1.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T1.js new file mode 100644 index 000000000..3f52d9527 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Type(NewExpression) or Type(MemberExpression) is not Object, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A3_T1.js + * @description Checking boolean primitive case + */ + +//CHECK#1 +try { + new true; + $ERROR('#1: new true throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new true throw TypeError'); + } +} + +//CHECK#2 +try { + var x = true; + new x; + $ERROR('#2: var x = true; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: var x = true; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = true; + new x(); + $ERROR('#3: var x = true; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = true; new x() throw TypeError'); + } +} + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T2.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T2.js new file mode 100644 index 000000000..1ad67c548 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T2.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Type(NewExpression) or Type(MemberExpression) is not Object, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A3_T2.js + * @description Checking "number primitive" case + */ + +//CHECK#1 +try { + new 1; + $ERROR('#1: new 1 throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new 1 throw TypeError'); + } +} + +//CHECK#2 +try { + var x = 1; + new x; + $ERROR('#2: var x = 1; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: var x = 1; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = 1; + new x(); + $ERROR('#3: var x = 1; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = 1; new x() throw TypeError'); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T3.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T3.js new file mode 100644 index 000000000..c93406012 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Type(NewExpression) or Type(MemberExpression) is not Object, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A3_T3.js + * @description Checking "string primitive" case + */ + +//CHECK#1 +try { + new 1; + $ERROR('#1: new "1" throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new "1" throw TypeError'); + } +} + +//CHECK#2 +try { + var x = "1"; + new x; + $ERROR('#2: var x = "1"; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: var x = "1"; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = "1"; + new x(); + $ERROR('#3: var x = "1"; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = "1"; new x() throw TypeError'); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T4.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T4.js new file mode 100644 index 000000000..adbd1356c --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T4.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Type(NewExpression) or Type(MemberExpression) is not Object, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A3_T4.js + * @description Checking "undefined" case + */ + +//CHECK#1 +try { + new undefined; + $ERROR('#1: new undefined throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new undefined throw TypeError'); + } +} + +//CHECK#2 +try { + var x = undefined; + new x; + $ERROR('#2: var x = undefined; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: var x = undefined; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = undefined; + new x(); + $ERROR('#3: var x = undefined; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = undefined; new x() throw TypeError'); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T5.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T5.js new file mode 100644 index 000000000..abf71da19 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A3_T5.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If Type(NewExpression) or Type(MemberExpression) is not Object, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A3_T5.js + * @description Checking "null primitive" case + */ + +//CHECK#1 +try { + new null; + $ERROR('#1: new null throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new null throw TypeError'); + } +} + +//CHECK#2 +try { + var x = null; + new x; + $ERROR('#2: var x = null; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: var x = null; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = null; + new x(); + $ERROR('#3: var x = null; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = null; new x() throw TypeError'); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T1.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T1.js new file mode 100644 index 000000000..cd6517cbf --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If NewExpression or MemberExpression does not implement internal [[Construct]] method, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A4_T1.js + * @description Checking Boolean object case + */ + +//CHECK#1 +try { + new new Boolean(true); + $ERROR('#1: new new Boolean(true) throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new new Boolean(true) throw TypeError'); + } +} + +//CHECK#2 +try { + var x = new Boolean(true); + new x; + $ERROR('#2: var x = new Boolean(true); new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: var x = new Boolean(true); new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = new Boolean(true); + new x(); + $ERROR('#3: var x = new Boolean(true); new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = new Boolean(true); new x() throw TypeError'); + } +} + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T2.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T2.js new file mode 100644 index 000000000..bc776ec65 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T2.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If NewExpression or MemberExpression does not implement internal [[Construct]] method, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A4_T2.js + * @description Checking Number object case + */ + +//CHECK#1 +try { + new new Number(1); + $ERROR('#1: new new Number(1) throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new new Number(1) throw TypeError'); + } +} + +//CHECK#2 +try { + var x = new Number(1); + new x; + $ERROR('#2: var x = new Number(1); new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: var x = new Number(1); new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = new Number(1); + new x(); + $ERROR('#3: var x = new Number(1); new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = new Number(1); new x() throw TypeError'); + } +} + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T3.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T3.js new file mode 100644 index 000000000..9027cf051 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T3.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If NewExpression or MemberExpression does not implement internal [[Construct]] method, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A4_T3.js + * @description Checking String object case + */ + +//CHECK#1 +try { + new new String("1"); + $ERROR('#1: new new String("1") throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new new String("1") throw TypeError'); + } +} + +//CHECK#2 +try { + var x = new String("1"); + new x; + $ERROR('#2: var x = new String("1"); new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: var x = new String("1"); new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = new String("1"); + new x(); + $ERROR('#3: var x = new String("1"); new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = new String("1"); new x() throw TypeError'); + } +} + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T4.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T4.js new file mode 100644 index 000000000..e240ba827 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T4.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. + +/** + * If NewExpression or MemberExpression does not implement internal [[Construct]] method, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A4_T4.js + * @description Checking Global object case + */ + +//CHECK#1 +try { + new this; + $ERROR('#1: new this throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new this throw TypeError'); + } +} + +//CHECK#2 +try { + new this(); + $ERROR('#2: new this() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: new this() throw TypeError'); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T5.js b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T5.js new file mode 100644 index 000000000..72fdae876 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/S11.2.2_A4_T5.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If NewExpression or MemberExpression does not implement internal [[Construct]] method, throw TypeError + * + * @path ch11/11.2/11.2.2/S11.2.2_A4_T5.js + * @description Checking Math object case + */ + +//CHECK#1 +try { + new Math; + $ERROR('#1: new Math throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1: new Math throw TypeError'); + } +} + +//CHECK#2 +try { + new new Math(); + $ERROR('#2: new new Math() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2: new new Math() throw TypeError'); + } +} + +//CHECK#3 +try { + var x = new Math(); + new x(); + $ERROR('#3: var x = new Math(); new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#3: var x = new Math(); new x() throw TypeError'); + } +} + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/browser.js b/js/src/tests/test262/ch11/11.2/11.2.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/browser.js diff --git a/js/src/tests/test262/ch11/11.2/11.2.2/shell.js b/js/src/tests/test262/ch11/11.2/11.2.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.2/shell.js diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_1.js b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_1.js new file mode 100644 index 000000000..8ae5b5e84 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_1.js @@ -0,0 +1,24 @@ +/// 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.2/11.2.3/11.2.3-3_1.js
+ * @description Call arguments are evaluated before the check is made to see if the object is actually callable (FunctionDeclaration)
+ */
+
+
+function testcase() {
+ var fooCalled = false;
+ function foo(){ fooCalled = true; }
+
+ var o = { };
+ try {
+ o.bar( foo() );
+ throw new Exception("o.bar does not exist!");
+ } catch(e) {
+ return (e instanceof TypeError) && (fooCalled===true);
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_2.js b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_2.js new file mode 100644 index 000000000..5e7496d51 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_2.js @@ -0,0 +1,24 @@ +/// 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.2/11.2.3/11.2.3-3_2.js
+ * @description Call arguments are evaluated before the check is made to see if the object is actually callable (FunctionExpression)
+ */
+
+
+function testcase() {
+ var fooCalled = false;
+ var foo = function (){ fooCalled = true; }
+
+ var o = { };
+ try {
+ o.bar( foo() );
+ throw new Exception("o.bar does not exist!");
+ } catch(e) {
+ return (e instanceof TypeError) && (fooCalled===true);
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_3.js b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_3.js new file mode 100644 index 000000000..04616e5a0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_3.js @@ -0,0 +1,24 @@ +/// 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.2/11.2.3/11.2.3-3_3.js
+ * @description Call arguments are not evaluated before the check is made to see if the object is actually callable (undefined member)
+ */
+
+
+function testcase() {
+ var fooCalled = false;
+ function foo(){ fooCalled = true; }
+
+ var o = { };
+ try {
+ o.bar.gar( foo() );
+ throw new Exception("o.bar does not exist!");
+ } catch(e) {
+ return (e instanceof TypeError) && (fooCalled===false);
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_4.js b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_4.js new file mode 100644 index 000000000..f6970fa79 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_4.js @@ -0,0 +1,26 @@ +/// 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.2/11.2.3/11.2.3-3_4.js
+ * @description Call arguments are evaluated before the check is made to see if the object is actually callable (property)
+ */
+
+
+function testcase() {
+ var fooCalled = false;
+ function foo(){ fooCalled = true; }
+
+ var o = { };
+ Object.defineProperty(o, "bar", {get: function() {this.barGetter = true; return 42;},
+ set: function(x) {this.barSetter = true; }});
+ try {
+ o.bar( foo() );
+ throw new Exception("o.bar does not exist!");
+ } catch(e) {
+ return (e instanceof TypeError) && (fooCalled===true) && (o.barGetter===true) && (o.barSetter===undefined);
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_5.js b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_5.js new file mode 100644 index 000000000..3e2315f03 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_5.js @@ -0,0 +1,24 @@ +/// 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.2/11.2.3/11.2.3-3_5.js
+ * @description Call arguments are evaluated before the check is made to see if the object is actually callable (eval'ed)
+ */
+
+
+function testcase() {
+ var fooCalled = false;
+ function foo(){ fooCalled = true; }
+
+ var o = { };
+ try {
+ eval("o.bar( foo() );");
+ throw new Exception("o.bar does not exist!");
+ } catch(e) {
+ return (e instanceof TypeError) && (fooCalled===true);
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_6.js b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_6.js new file mode 100644 index 000000000..c2bfcc45a --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_6.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.2/11.2.3/11.2.3-3_6.js
+ * @description Call arguments are evaluated before the check is made to see if the object is actually callable (getter called)
+ */
+
+
+function testcase() {
+ var o = { };
+ Object.defineProperty(o, "bar", {get: function() {this.barGetter = true; return 42;},
+ set: function(x) {this.barSetter = true; }});
+ try {
+ o.foo( o.bar );
+ throw new Exception("o.foo does not exist!");
+ } catch(e) {
+ return (e instanceof TypeError) && (o.barGetter===true) && (o.barSetter===undefined);
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_7.js b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_7.js new file mode 100644 index 000000000..2c320e778 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_7.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.2/11.2.3/11.2.3-3_7.js
+ * @description Call arguments are evaluated before the check is made to see if the object is actually callable (getter called as indexed property)
+ */
+
+
+function testcase() {
+ var o = { };
+ Object.defineProperty(o, "bar", {get: function() {this.barGetter = true; return 42;},
+ set: function(x) {this.barSetter = true; }});
+ try {
+ o.foo( o["bar"] );
+ throw new Exception("o.foo does not exist!");
+ } catch(e) {
+ return (e instanceof TypeError) && (o.barGetter===true) && (o.barSetter===undefined);
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_8.js b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_8.js new file mode 100644 index 000000000..67e5b9b80 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/11.2.3-3_8.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.
+/**
+ * @path ch11/11.2/11.2.3/11.2.3-3_8.js
+ * @description Call arguments are evaluated before the check is made to see if the object is actually callable (global object)
+ */
+
+
+function testcase() {
+ if (this!==fnGlobalObject()) {
+ return;
+ }
+
+ var fooCalled = false;
+ function foo(){ fooCalled = true; }
+
+ try {
+ this.bar( foo() );
+ throw new Exception("this.bar does not exist!");
+ } catch(e) {
+ return (e instanceof TypeError) && (fooCalled===true);
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A1.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A1.js new file mode 100644 index 000000000..19dfdce73 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_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 between MemberExpression and Arguments are allowed + * + * @path ch11/11.2/11.2.3/S11.2.3_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("Number\u0009()") !== 0) { + $ERROR('#1: Number\\u0009() === 0'); +} + +//CHECK#2 +if (eval("Number\u000B()") !== 0) { + $ERROR('#2: Number\\u000B() === 0'); +} + +//CHECK#3 +if (eval("Number\u000C()") !== 0) { + $ERROR('#3: Number\\u000C() === 0'); +} + +//CHECK#4 +if (eval("Number\u0020()") !== 0) { + $ERROR('#4: Number\\u0020 === 0'); +} + +//CHECK#5 +if (eval("Number\u00A0()") !== 0) { + $ERROR('#5: Number\\u00A0() === 0'); +} + +//CHECK#6 +if (eval("Number\u000A()") !== 0) { + $ERROR('#6: Number\\u000A() === 0'); +} + +//CHECK#7 +if (eval("Number\u000D()") !== 0) { + $ERROR('#7: Number\\u000D() === 0'); +} + +//CHECK#8 +if (eval("Number\u2028()") !== 0) { + $ERROR('#8: Number\\u2028() === 0'); +} + +//CHECK#9 +if (eval("Number\u2029()") !== 0) { + $ERROR('#9: Number\\u2029() === 0'); +} + +//CHECK#10 +if (eval("Number\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029()") !== 0) { + $ERROR('#10: Number\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029() === 0'); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A2.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A2.js new file mode 100644 index 000000000..29ae4a55a --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A2.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. + +/** + * CallExpression : MemberExpression Arguments uses GetValue + * + * @path ch11/11.2/11.2.3/S11.2.3_A2.js + * @description If GetBase(MemberExpression) is null, throw ReferenceError + */ + +//CHECK#1 +try { + x(); + $ERROR('#1.1: x() throw ReferenceError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x() throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + x(1,2,3); + $ERROR('#2.1: x(1,2,3) throw ReferenceError. Actual: ' + (x(1,2,3))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#2.2: x(1,2,3) throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T1.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T1.js new file mode 100644 index 000000000..5fbf7b68d --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T1.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If MemberExpression is not Object, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A3_T1.js + * @description Checking "boolean primitive" case + */ + +//CHECK#1 +try { + true(); + $ERROR('#1.1: true() throw TypeError. Actual: ' + (true())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: true() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = true; + x(); + $ERROR('#2.1: var x = true; x() throw TypeError. Actual: ' + (x())) +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: var x = true; x() throw TypeError. Actual: ' + (e)) + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T2.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T2.js new file mode 100644 index 000000000..253f1b0e6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If MemberExpression is not Object, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A3_T2.js + * @description Checking "number primitive" case + */ + +//CHECK#1 +try { + 1(); + $ERROR('#1.1: 1() throw TypeError. Actual: ' + (1())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: 1() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = 1; + x(); + $ERROR('#2.1: var x = 1; x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: var x = 1; x() throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T3.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T3.js new file mode 100644 index 000000000..388510f21 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T3.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If MemberExpression is not Object, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A3_T3.js + * @description Checking "string primitive" case + */ + +//CHECK#1 +try { + "1"(); + $ERROR('#1.1: "1"() throw TypeError. Actual: ' + ("1"())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: "1"() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = "1"; + x(); + $ERROR('#2.1: var x = "1"; x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: var x = "1"; x() throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T4.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T4.js new file mode 100644 index 000000000..a167260ed --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T4.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If MemberExpression is not Object, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A3_T4.js + * @description Checking "undefined" case + */ + +//CHECK#1 +try { + undefined(); + $ERROR('#1.1: undefined() throw TypeError. Actual: ' + (e)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: undefined() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = undefined; + x(); + $ERROR('#2.1: var x = undefined; x() throw TypeError. Actual: ' + (e)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: var x = undefined; x() throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T5.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T5.js new file mode 100644 index 000000000..77cd76fa4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A3_T5.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If MemberExpression is not Object, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A3_T5.js + * @description Checking "null" case + */ + +//CHECK#1 +try { + null(); + $ERROR('#1.1: null() throw TypeError. Actual: ' + (null())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: null() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = null; + x(); + $ERROR('#2.1: var x = null; x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: var x = null; x() throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T1.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T1.js new file mode 100644 index 000000000..ca028fa5a --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T1.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. + +/** + * If MemberExpression does not implement the internal [[Call]] method, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A4_T1.js + * @description Checking Boolean object case + */ + +//CHECK#1 +try { + new Boolean(true)(); + $ERROR('#1.1: new Boolean(true)() throw TypeError. Actual: ' + (new Boolean(true)())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new Boolean(true)() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = new Boolean(true); + x(); + $ERROR('#2.1: var x = new Boolean(true); x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: var x = new Boolean(true); x() throw TypeError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T2.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T2.js new file mode 100644 index 000000000..41f898305 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T2.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. + +/** + * If MemberExpression does not implement the internal [[Call]] method, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A4_T2.js + * @description Checking Number object case + */ + +//CHECK#1 +try { + new Number(1)(); + $ERROR('#1.1: new Number(1)() throw TypeError. Actual: ' + (new Number(1)())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new Number(1)() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = new Number(1); + x(); + $ERROR('#2.1: var x = new Number(1); x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: var x = new Number(1); x() throw TypeError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T3.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T3.js new file mode 100644 index 000000000..108085425 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T3.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If MemberExpression does not implement the internal [[Call]] method, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A4_T3.js + * @description Checking String object case + */ + +//CHECK#1 +try { + new String("1")(); + $ERROR('#1.1: new String("1")() throw TypeError. Actual: ' + (new String("1")())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new String("1")() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = new String("1"); + x(); + $ERROR('#2.1: var x = new String("1"); x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#2.2: var x = new String("1"); x() throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T4.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T4.js new file mode 100644 index 000000000..a19cc05e6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T4.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. + +/** + * If MemberExpression does not implement the internal [[Call]] method, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A4_T4.js + * @description Checking Global object case + */ + +//CHECK#1 +try { + this(); + $ERROR('#1.1: this() throw TypeError. Actual: ' + (this())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: this() throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T5.js b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_T5.js new file mode 100644 index 000000000..ddaf40c8d --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/S11.2.3_A4_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. + +/** + * If MemberExpression does not implement the internal [[Call]] method, throw TypeError + * + * @path ch11/11.2/11.2.3/S11.2.3_A4_T5.js + * @description Checking Math object case + */ + +//CHECK#1 +try { + Math(); + $ERROR('#1.1: Math() throw TypeError. Actual: ' + (Math())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: Math() throw TypeError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/browser.js b/js/src/tests/test262/ch11/11.2/11.2.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/browser.js diff --git a/js/src/tests/test262/ch11/11.2/11.2.3/shell.js b/js/src/tests/test262/ch11/11.2/11.2.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.3/shell.js diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T1.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T1.js new file mode 100644 index 000000000..0d31a6c22 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T1.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. + +/** + * Arguments : () + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.1_T1.js + * @description Function is declared with no FormalParameterList + */ + +function f_arg() { + return arguments; +} + +//CHECK#1 +if (f_arg().length !== 0) { + $ERROR('#1: function f_arg() {return arguments;} f_arg().length === 0. Actual: ' + (f_arg().length)); +} + +//CHECK#2 +if (f_arg()[0] !== undefined) { + $ERROR('#2: function f_arg() {return arguments;} f_arg()[0] === undefined. Actual: ' + (f_arg()[0])); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T2.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T2.js new file mode 100644 index 000000000..6be2a9937 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.1_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : () + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.1_T2.js + * @description Function is declared with FormalParameterList + */ + +function f_arg(x,y) { + return arguments; +} + +//CHECK#1 +if (f_arg().length !== 0) { + $ERROR('#1: function f_arg(x,y) {return arguments;} f_arg().length === 0. Actual: ' + (f_arg().length)); +} + +//CHECK#2 +if (f_arg()[0] !== undefined) { + $ERROR('#2: function f_arg(x,y) {return arguments;} f_arg()[0] === undefined. Actual: ' + (f_arg()[0])); +} + +//CHECK#3 +if (f_arg.length !== 2) { + $ERROR('#3: function f_arg(x,y) {return arguments;} f_arg.length === 2. Actual: ' + (f_arg.length)); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T1.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T1.js new file mode 100644 index 000000000..aa419e295 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.2_T1.js + * @description Function is declared with no FormalParameterList + */ + +f_arg = function() { + return arguments; +} + +//CHECK#1 +if (f_arg(1,2,3).length !== 3) { + $ERROR('#1: f_arg = function()() {return arguments;} f_arg(1,2,3).length === 3. Actual: ' + (f_arg(1,2,3).length)); +} + +//CHECK#2 +if (f_arg(1,2,3)[0] !== 1) { + $ERROR('#1: f_arg = function()() {return arguments;} f_arg(1,2,3)[0] === 1. Actual: ' + (f_arg(1,2,3)[0])); +} + +//CHECK#3 +if (f_arg(1,2,3)[1] !== 2) { + $ERROR('#3: f_arg = function()() {return arguments;} f_arg(1,2,3)[1] === 2. Actual: ' + (f_arg(1,2,3)[1])); +} + +//CHECK#4 +if (f_arg(1,2,3)[2] !== 3) { + $ERROR('#4: f_arg = function()() {return arguments;} f_arg(1,2,3)[2] === 3. Actual: ' + (f_arg(1,2,3)[2])); +} + +//CHECK#5 +if (f_arg(1,2,3)[3] !== undefined) { + $ERROR('#5: f_arg = function()() {return arguments;} f_arg(1,2,3)[3] === undefined. Actual: ' + (f_arg(1,2,3)[3])); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T2.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T2.js new file mode 100644 index 000000000..2541df3d1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.2_T2.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. + +/** + * Arguments : (ArgumentList) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.2_T2.js + * @description Function is declared with FormalParameterList + */ + +f_arg = function(x,y) { + return arguments; +} + +//CHECK#1 +if (f_arg(1,2,3).length !== 3) { + $ERROR('#1: f_arg = function(x,y) {return arguments;} f_arg(1,2,3).length === 3. Actual: ' + (f_arg(1,2,3).length)); +} + +//CHECK#2 +if (f_arg(1)[0] !== 1) { + $ERROR('#1: f_arg = function(x,y) {return arguments;} f_arg(1)[0] === 1. Actual: ' + (f_arg(1)[0])); +} + +//CHECK#3 +if (f_arg(1,2)[1] !== 2) { + $ERROR('#3: f_arg = function(x,y) {return arguments;} f_arg(1,2)[1] === 2. Actual: ' + (f_arg(1,2)[1])); +} + +//CHECK#4 +if (f_arg(1,2,3)[2] !== 3) { + $ERROR('#4: f_arg = function(x,y) {return arguments;} f_arg(1,2,3)[2] === 3. Actual: ' + (f_arg(1,2,3)[2])); +} + +//CHECK#5 +if (f_arg(1,2,3)[3] !== undefined) { + $ERROR('#5: f_arg = function(x,y) {return arguments;} f_arg(1,2,3)[3] === undefined. Actual: ' + (f_arg(1,2,3)[3])); +} + +//CHECK#6 +if (f_arg.length !== 2) { + $ERROR('#6: f_arg = function(x,y) {return arguments;} f_arg.length === 2. Actual: ' + (f_arg.length)); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.3_T1.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.3_T1.js new file mode 100644 index 000000000..e54238ea1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.3_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. + +/** + * Arguments : (ArgumentList : ArgumentList,, AssignmentExpression) is a bad syntax + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.3_T1.js + * @description incorrect syntax + * @negative + */ + +function f_arg() { +} + +f_arg(1,,2); + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T1.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T1.js new file mode 100644 index 000000000..a2eb7989b --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments : (ArgumentList : ArgumentList, AssignmentExpression) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.4_T1.js + * @description Return an internal list whose length is one greater than the + * length of ArgumentList and whose items are the items of ArgumentList, in order, + * followed at the end by GetValue(AssignmentExpression), which is the last item of + * the new list + */ + +function f_arg() { +} + +//CHECK#1 +f_arg(x=1,x); + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T2.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T2.js new file mode 100644 index 000000000..0db853abd --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T2.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. + +/** + * Arguments : (ArgumentList : ArgumentList, AssignmentExpression) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.4_T2.js + * @description Return an internal list whose length is one greater than the + * length of ArgumentList and whose items are the items of ArgumentList, in order, + * followed at the end by GetValue(AssignmentExpression), which is the last item of + * the new list + */ + +function f_arg() { +} + +//CHECK#1 +try { + f_arg(x,x=1); + $ERROR('#1.1: function f_arg() {} f_arg(x,x=1) throw ReferenceError. Actual: ' + (f_arg(x,x=1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: function f_arg() {} f_arg(x,x=1) throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T3.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T3.js new file mode 100644 index 000000000..7d8bd02c9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T3.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. + +/** + * Arguments : (ArgumentList : ArgumentList, AssignmentExpression) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.4_T3.js + * @description Return an internal list whose length is one greater than the + * length of ArgumentList and whose items are the items of ArgumentList, in order, + * followed at the end by GetValue(AssignmentExpression), which is the last item of + * the new list + */ + +function f_arg(x,y,z) { + return z; +} + +//CHECK#1 +if (f_arg(x=1,y=x,x+y) !== 2) { + $ERROR('#1: function f_arg(x,y,z) {return z;} f_arg(x=1,y=x,x+y) === 2. Actual: ' + (f_arg(x=1,y=x,x+y))); +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T4.js b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T4.js new file mode 100644 index 000000000..83b228a88 --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/S11.2.4_A1.4_T4.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. + +/** + * Arguments : (ArgumentList : ArgumentList, AssignmentExpression) + * + * @path ch11/11.2/11.2.4/S11.2.4_A1.4_T4.js + * @description Return an internal list whose length is one greater than the + * length of ArgumentList and whose items are the items of ArgumentList, in order, + * followed at the end by GetValue(AssignmentExpression), which is the last item of + * the new list + */ + +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; + +function f_arg() { +} + +//CHECK#1 +try { + f_arg(x(),y()); + $ERROR('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; function f_arg() {} f_arg(x(),y()) throw "x". Actual: ' + (f_arg(x(),y()))); +} +catch (e) { + if (e === "y") { + $ERROR('#1.2: First argument is evaluated first, and then second argument'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; function f_arg() {} f_arg(x(),y()) throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/browser.js b/js/src/tests/test262/ch11/11.2/11.2.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/browser.js diff --git a/js/src/tests/test262/ch11/11.2/11.2.4/shell.js b/js/src/tests/test262/ch11/11.2/11.2.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/11.2.4/shell.js diff --git a/js/src/tests/test262/ch11/11.2/browser.js b/js/src/tests/test262/ch11/11.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/browser.js diff --git a/js/src/tests/test262/ch11/11.2/shell.js b/js/src/tests/test262/ch11/11.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.2/shell.js |