Bug 496923 - Import the ch11/ test262 tests into jstests. r=generating-script-was-reviewed

--HG--
extra : rebase_source : e83eb03850d7283fffe3aa81d72d9198427b2771
This commit is contained in:
Jeff Walden 2013-06-04 17:32:01 -07:00
parent e446971018
commit 7492ddf9dc
1440 changed files with 77873 additions and 0 deletions

View File

@ -0,0 +1,16 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.1/11.1.1-1gs.js
* @description Strict Mode - 'this' object at the global scope is not undefined
* @onlyStrict
*/
"use strict";
if (this===undefined) {
throw NotEarlyError;
}

View File

@ -0,0 +1,13 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* The "this" is reserved word
*
* @path ch11/11.1/11.1.1/S11.1.1_A1.js
* @description Checking if execution of "this=1" fails
* @negative
*/
this = 1;

View File

@ -0,0 +1,25 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Being in function code, "this" and eval("this"), called as a functions, return the global object
*
* @path ch11/11.1/11.1.1/S11.1.1_A3.1.js
* @description Creating function which returns "this" or eval("this")
* @noStrict
*/
//CHECK#1
function MyFunction() {return this}
if (MyFunction() !== this) {
$ERROR('#1: function MyFunction() {return this} MyFunction() === this. Actual: ' + (MyFunction()));
}
//CHECK#2
function MyFunction() {return eval("this")}
if (MyFunction() !== this) {
$ERROR('#2: function MyFunction() {return eval("this")} MyFunction() === this. Actual: ' + (MyFunction()));
}

View File

@ -0,0 +1,24 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Being in function code, "this" and eval("this"), called as a constructors, return the object
*
* @path ch11/11.1/11.1.1/S11.1.1_A3.2.js
* @description Create function. It have property, that returned "this"
* @noStrict
*/
//CHECK#1
function MyFunction() {this.THIS = this}
if ((new MyFunction()).THIS.toString() !== "[object Object]") {
$ERROR('#1: function MyFunction() {this.THIS = this} (new MyFunction()).THIS.toString() !== "[object Object]". Actual: ' + ((new MyFunction()).THIS.toString()));
}
//CHECK#2
function MyFunction() {this.THIS = eval("this")}
if ((new MyFunction()).THIS.toString() !== "[object Object]") {
$ERROR('#2: function MyFunction() {this.THIS = eval("this")} (new MyFunction()).THIS.toString() !== "[object Object]". Actual: ' + ((new MyFunction()).THIS.toString()));
}

View File

@ -0,0 +1,24 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Being in anonymous code, "this" and eval("this"), called as a function, return the global object
*
* @path ch11/11.1/11.1.1/S11.1.1_A4.1.js
* @description Creating function with new Function() constructor
*/
//CHECK#1
var MyFunction = new Function("return this");
if (MyFunction() !== this) {
$ERROR('#1: var MyFunction = new Function("return this"); MyFunction() === this. Actual: ' + (MyFunction()));
}
//CHECK#2
MyFunction = new Function("return eval(\'this\')");
if (MyFunction() !== this) {
$ERROR('#2: var MyFunction = new Function("return eval(\'this\')"); MyFunction() === this. Actual: ' + (MyFunction()));
}

View File

@ -0,0 +1,25 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Being in anonymous code, "this" and eval("this"), called as a constructor, return the object
*
* @path ch11/11.1/11.1.1/S11.1.1_A4.2.js
* @description Creating function by using new Function() constructor. It has the property, which returns "this"
*/
//CHECK#1
var MyFunction = new Function("this.THIS = this");
var MyObject = new MyFunction();
if (MyObject.THIS.toString() !== "[object Object]") {
$ERROR('#1: var MyFunction = new Function("this.THIS = this"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString()));
}
//CHECK#2
MyFunction = new Function("this.THIS = eval(\'this\')");
MyObject = new MyFunction();
if (MyObject.THIS.toString() !== "[object Object]") {
$ERROR('#2: var MyFunction = new Function("this.THIS = eval(\'this\')"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString()));
}

View File

@ -0,0 +1,27 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* The result of evaluating an Identifier is always a value of type Reference
*
* @path ch11/11.1/11.1.2/S11.1.2_A1_T1.js
* @description Creating variables without defining it
*/
//CHECK#1
if (this.x !== undefined) {
$ERROR('#1: this.x === undefined. Actual: ' + (this.x));
}
//CHECK#2
var object = new Object();
if (object.prop !== undefined) {
$ERROR('#2: var object = new Object(); object.prop === undefined. Actual: ' + (object.prop));
}
//CHECK#3
this.y++;
if (isNaN(y) !== true) {
$ERROR('#3: this.y++; y === Not-a-Number. Actual: ' + (y));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* The result of evaluating an Identifier is always a value of type Reference
*
* @path ch11/11.1/11.1.2/S11.1.2_A1_T2.js
* @description Trying to generate ReferenceError
*/
//CHECK#1
try {
this.z;
z;
$ERROR('#1.1: this.z; z === undefined throw ReferenceError. Actual: ' + (z));
} catch(e) {
if ((e instanceof ReferenceError) !== true) {
$ERROR('#1.2: this.z; z === undefined throw ReferenceError. Actual: ' + (e));
}
}

View File

@ -0,0 +1,18 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.4/11.1.4-0.js
* @description elements elided at the end of an array do not contribute to its length
*/
function testcase() {
var a = [,];
if (a.length === 1) {
return true;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,32 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.4;
* The production
* ElementList : Elisionopt AssignmentExpression
* 5.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(firstIndex), the Property Descriptor { [[Value]]: initValue, [[Writable]]: true
* , [[Enumerable]]: true, [[Configurable]]: true}, and false.
*
* @path ch11/11.1/11.1.4/11.1.4_4-5-1.js
* @description Initialize array using ElementList (Elisionopt AssignmentExpression) when index property (read-only) exists in Array.prototype (step 5)
*/
function testcase() {
try {
Object.defineProperty(Array.prototype, "0", {
value: 100,
writable: false,
configurable: true
});
var arr = [101];
return arr.hasOwnProperty("0") && arr[0] === 101;
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -0,0 +1,32 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.4;
* The production
* ElementList : ElementList , Elisionopt AssignmentExpression
* 6.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(ToUint32((pad+len)) and the Property Descriptor { [[Value]]: initValue
* , [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false.
*
* @path ch11/11.1/11.1.4/11.1.4_5-6-1.js
* @description Initialize array using ElementList (ElementList , Elisionopt AssignmentExpression) when index property (read-only) exists in Array.prototype (step 6)
*/
function testcase() {
try {
Object.defineProperty(Array.prototype, "1", {
value: 100,
writable: false,
configurable: true
});
var arr = [101, 12];
return arr.hasOwnProperty("1") && arr[1] === 12;
} finally {
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -0,0 +1,32 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ArrayLiteral: [ ]
*
* @path ch11/11.1/11.1.4/S11.1.4_A1.1.js
* @description Checking various properties of the array defined with expression "var array = []"
*/
var array = [];
//CHECK#1
if (typeof array !== "object") {
$ERROR('#1: var array = []; typeof array === "object". Actual: ' + (typeof array));
}
//CHECK#2
if (array instanceof Array !== true) {
$ERROR('#2: var array = []; array instanceof Array === true');
}
//CHECK#3
if (array.toString !== Array.prototype.toString) {
$ERROR('#3: var array = []; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}
//CHECK#4
if (array.length !== 0) {
$ERROR('#4: var array = []; array.length === 0. Actual: ' + (array.length));
}

View File

@ -0,0 +1,32 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ArrayLiteral: [ Elision ]
*
* @path ch11/11.1/11.1.4/S11.1.4_A1.2.js
* @description Checking various properties the array defined with "var array = [,,,,,]"
*/
var array = [,,,,,];
//CHECK#1
if (typeof array !== "object") {
$ERROR('#1: var array = [,,,,,]; typeof array === "object". Actual: ' + (typeof array));
}
//CHECK#2
if (array instanceof Array !== true) {
$ERROR('#2: var array = [,,,,,]; array instanceof Array === true');
}
//CHECK#3
if (array.toString !== Array.prototype.toString) {
$ERROR('#3: var array = [,,,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}
//CHECK#4
if (array.length !== 5) {
$ERROR('#4: var array = [,,,,,]; array.length === 5. Actual: ' + (array.length));
}

View File

@ -0,0 +1,57 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ArrayLiteral: [ AssignmentExpression ]
*
* @path ch11/11.1/11.1.4/S11.1.4_A1.3.js
* @description Checking various properteis and contents of the array defined with "var array = [1,2,3,4,5]"
*/
var array = [1,2,3,4,5];
//CHECK#1
if (typeof array !== "object") {
$ERROR('#1: var array = [1,2,3,4,5]; typeof array === "object". Actual: ' + (typeof array));
}
//CHECK#2
if (array instanceof Array !== true) {
$ERROR('#2: var array = [1,2,3,4,5]; array instanceof Array === true');
}
//CHECK#3
if (array.toString !== Array.prototype.toString) {
$ERROR('#3: var array = [1,2,3,4,5]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}
//CHECK#4
if (array.length !== 5) {
$ERROR('#4: var array = [1,2,3,4,5]; array.length === 5. Actual: ' + (array.length));
}
//CHECK#5
if (array[0] !== 1) {
$ERROR('#5: var array = [1,2,3,4,5]; array[0] === 1. Actual: ' + (array[0]));
}
//CHECK#6
if (array[1] !== 2) {
$ERROR('#6: var array = [1,2,3,4,5]; array[1] === 2. Actual: ' + (array[1]));
}
//CHECK#7
if (array[2] !== 3) {
$ERROR('#7: var array = [1,2,3,4,5]; array[2] === 3. Actual: ' + (array[2]));
}
//CHECK#8
if (array[3] !== 4) {
$ERROR('#8: var array = [1,2,3,4,5]; array[3] === 4. Actual: ' + (array[3]));
}
//CHECK#9
if (array[4] !== 5) {
$ERROR('#9: var array = [1,2,3,4,5]; array[4] === 5. Actual: ' + (array[4]));
}

View File

@ -0,0 +1,57 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ArrayLiteral: [ Elision, AssignmentExpression ]
*
* @path ch11/11.1/11.1.4/S11.1.4_A1.4.js
* @description Checking various properteis and content of the array defined with "var array = [,,,1,2]"
*/
var array = [,,,1,2];
//CHECK#1
if (typeof array !== "object") {
$ERROR('#1: var array = [,,,1,2]; typeof array === "object". Actual: ' + (typeof array));
}
//CHECK#2
if (array instanceof Array !== true) {
$ERROR('#2: var array = [,,,1,2]; array instanceof Array === true');
}
//CHECK#3
if (array.toString !== Array.prototype.toString) {
$ERROR('#3: var array = [,,,1,2]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}
//CHECK#4
if (array.length !== 5) {
$ERROR('#4: var array = [,,,1,2]; array.length === 5. Actual: ' + (array.length));
}
//CHECK#5
if (array[0] !== undefined) {
$ERROR('#5: var array = [,,,1,2]; array[0] === undefined. Actual: ' + (array[0]));
}
//CHECK#6
if (array[1] !== undefined) {
$ERROR('#6: var array = [,,,1,2]; array[1] === undefined. Actual: ' + (array[1]));
}
//CHECK#7
if (array[2] !== undefined) {
$ERROR('#7: var array = [,,,1,2]; array[2] === undefined. Actual: ' + (array[2]));
}
//CHECK#8
if (array[3] !== 1) {
$ERROR('#8: var array = [,,,1,2]; array[3] === 1. Actual: ' + (array[3]));
}
//CHECK#9
if (array[4] !== 2) {
$ERROR('#9: var array = [,,,1,2]; array[4] === 2. Actual: ' + (array[4]));
}

View File

@ -0,0 +1,57 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision ]
*
* @path ch11/11.1/11.1.4/S11.1.4_A1.5.js
* @description Checking various properteis and contents of the array defined with "var array = [4,5,,,,]"
*/
var array = [4,5,,,,];
//CHECK#1
if (typeof array !== "object") {
$ERROR('#1: var array = [4,5,,,,]; typeof array === "object". Actual: ' + (typeof array));
}
//CHECK#2
if (array instanceof Array !== true) {
$ERROR('#2: var array = [4,5,,,,]; array instanceof Array === true');
}
//CHECK#3
if (array.toString !== Array.prototype.toString) {
$ERROR('#3: var array = [4,5,,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}
//CHECK#4
if (array.length !== 5) {
$ERROR('#4: var array = [4,5,,,,]; array.length === 5. Actual: ' + (array.length));
}
//CHECK#5
if (array[0] !== 4) {
$ERROR('#5: var array = [4,5,,,,]; array[0] === 4. Actual: ' + (array[0]));
}
//CHECK#6
if (array[1] !== 5) {
$ERROR('#6: var array = [4,5,,,,]; array[1] === 5. Actual: ' + (array[1]));
}
//CHECK#7
if (array[2] !== undefined) {
$ERROR('#7: var array = [4,5,,,,]; array[2] === undefined. Actual: ' + (array[2]));
}
//CHECK#8
if (array[3] !== undefined) {
$ERROR('#8: var array = [4,5,,,,]; array[3] === undefined. Actual: ' + (array[3]));
}
//CHECK#9
if (array[4] !== undefined) {
$ERROR('#9: var array = [4,5,,,,]; array[4] === undefined. Actual: ' + (array[4]));
}

View File

@ -0,0 +1,57 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ArrayLiteral: [ Elision, AssignmentExpression, Elision ]
*
* @path ch11/11.1/11.1.4/S11.1.4_A1.6.js
* @description Checking various properteis and contents of the array defined with "var array = [,,3,,,]"
*/
var array = [,,3,,,];
//CHECK#1
if (typeof array !== "object") {
$ERROR('#1: var array = [,,3,,,]; typeof array === "object". Actual: ' + (typeof array));
}
//CHECK#2
if (array instanceof Array !== true) {
$ERROR('#2: var array = [,,3,,,]; array instanceof Array === true');
}
//CHECK#3
if (array.toString !== Array.prototype.toString) {
$ERROR('#3: var array = [,,3,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}
//CHECK#4
if (array.length !== 5) {
$ERROR('#4: var array = [,,3,,,]; array.length === 5. Actual: ' + (array.length));
}
//CHECK#5
if (array[0] !== undefined) {
$ERROR('#5: var array = [,,3,,,]; array[0] === undefined. Actual: ' + (array[0]));
}
//CHECK#6
if (array[1] !== undefined) {
$ERROR('#6: var array = [,,3,,,]; array[1] === undefined. Actual: ' + (array[1]));
}
//CHECK#7
if (array[2] !== 3) {
$ERROR('#7: var array = [,,3,,,]; array[2] === 3. Actual: ' + (array[2]));
}
//CHECK#8
if (array[3] !== undefined) {
$ERROR('#8: var array = [,,3,,,]; array[3] === undefined. Actual: ' + (array[3]));
}
//CHECK#9
if (array[4] !== undefined) {
$ERROR('#9: var array = [,,3,,,]; array[4] === undefined. Actual: ' + (array[4]));
}

View File

@ -0,0 +1,57 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision, AssignmentExpression ]
*
* @path ch11/11.1/11.1.4/S11.1.4_A1.7.js
* @description Checking various properteis and contents of the array defined with "var array = [1,2,,4,5]"
*/
var array = [1,2,,4,5];
//CHECK#1
if (typeof array !== "object") {
$ERROR('#1: var array = [1,2,,4,5]; typeof array === "object". Actual: ' + (typeof array));
}
//CHECK#2
if (array instanceof Array !== true) {
$ERROR('#2: var array = [1,2,,4,5]; array instanceof Array === true');
}
//CHECK#3
if (array.toString !== Array.prototype.toString) {
$ERROR('#3: var array = [1,2,,4,5]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}
//CHECK#4
if (array.length !== 5) {
$ERROR('#4: var array = [1,2,,4,5]; array.length === 5. Actual: ' + (array.length));
}
//CHECK#5
if (array[0] !== 1) {
$ERROR('#5: var array = [1,2,,4,5]; array[0] === 1. Actual: ' + (array[0]));
}
//CHECK#6
if (array[1] !== 2) {
$ERROR('#6: var array = [1,2,,4,5]; array[1] === 2. Actual: ' + (array[1]));
}
//CHECK#7
if (array[2] !== undefined) {
$ERROR('#7: var array = [1,2,,4,5]; array[2] === undefined. Actual: ' + (array[2]));
}
//CHECK#8
if (array[3] !== 4) {
$ERROR('#8: var array = [1,2,,4,5]; array[3] === 4. Actual: ' + (array[3]));
}
//CHECK#9
if (array[4] !== 5) {
$ERROR('#9: var array = [1,2,,4,5]; array[4] === 5. Actual: ' + (array[4]));
}

View File

@ -0,0 +1,128 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Create multi dimensional array
*
* @path ch11/11.1/11.1.4/S11.1.4_A2.js
* @description Checking various properteis and contents of the arrya defined with "var array = [[1,2], [3], []]"
*/
var array = [[1,2], [3], []];
//CHECK#1
if (typeof array !== "object") {
$ERROR('#1: var array = [[1,2], [3], []]; typeof array === "object". Actual: ' + (typeof array));
}
//CHECK#2
if (array instanceof Array !== true) {
$ERROR('#2: var array = [[1,2], [3], []]; array instanceof Array === true');
}
//CHECK#3
if (array.toString !== Array.prototype.toString) {
$ERROR('#3: var array = [[1,2], [3], []]; array.toString === Array.prototype.toString. Actual: ' + (array.toString));
}
//CHECK#4
if (array.length !== 3) {
$ERROR('#4: var array = [[1,2], [3], []]; array.length === 3. Actual: ' + (array.length));
}
var subarray = array[0];
//CHECK#5
if (typeof subarray !== "object") {
$ERROR('#5: var array = [[1,2], [3], []]; var subarray = array[0]; typeof subarray === "object". Actual: ' + (typeof subarray));
}
//CHECK#6
if (subarray instanceof Array !== true) {
$ERROR('#6: var array = [[1,2], [3], []]; var subarray = array[0]; subarray instanceof Array === true');
}
//CHECK#7
if (subarray.toString !== Array.prototype.toString) {
$ERROR('#7: var array = [[1,2], [3], []]; var subarray = array[0]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString));
}
//CHECK#8
if (subarray.length !== 2) {
$ERROR('#8: var array = [[1,2], [3], []]; var subarray = array[0]; subarray.length === 2. Actual: ' + (subarray.length));
}
//CHECK#9
if (subarray[0] !== 1) {
$ERROR('#9: var array = [[1,2], [3], []]; var subarray = array[0]; subarray[0] === 1. Actual: ' + (subarray[0]));
}
//CHECK#10
if (subarray[1] !== 2) {
$ERROR('#10: var array = [[1,2], [3], []]; var subarray = array[1]; subarray[1] === 2. Actual: ' + (subarray[1]));
}
var subarray = array[1];
//CHECK#11
if (typeof subarray !== "object") {
$ERROR('#11: var array = [[1,2], [3], []]; var subarray = array[1]; typeof subarray === "object". Actual: ' + (typeof subarray));
}
//CHECK#12
if (subarray instanceof Array !== true) {
$ERROR('#12: var array = [[1,2], [3], []]; var subarray = array[1]; subarray instanceof Array === true');
}
//CHECK#13
if (subarray.toString !== Array.prototype.toString) {
$ERROR('#13: var array = [[1,2], [3], []]; var subarray = array[1]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString));
}
//CHECK#14
if (subarray.length !== 1) {
$ERROR('#14: var array = [[1,2], [3], []]; var subarray = array[1]; subarray.length === 1. Actual: ' + (subarray.length));
}
//CHECK#15
if (subarray[0] !== 3) {
$ERROR('#15: var array = [[1,2], [3], []]; var subarray = array[1]; subarray[0] === 3. Actual: ' + (subarray[0]));
}
var subarray = array[2];
//CHECK#16
if (typeof subarray !== "object") {
$ERROR('#16: var array = [[1,2], [3], []]; var subarray = array[2]; typeof subarray === "object". Actual: ' + (typeof subarray));
}
//CHECK#17
if (subarray instanceof Array !== true) {
$ERROR('#17: var array = [[1,2], [3], []]; var subarray = array[2]; subarray instanceof Array === true');
}
//CHECK#18
if (subarray.toString !== Array.prototype.toString) {
$ERROR('#18: var array = [[1,2], [3], []]; var subarray = array[2]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString));
}
//CHECK#19
if (subarray.length !== 0) {
$ERROR('#19: var array = [[1,2], [3], []]; var subarray = array[2]; subarray.length === 0. Actual: ' + (subarray.length));
}
//CHECK#20
if (array[0][0] !== 1) {
$ERROR('#20: var array = [[1,2], [3], []]; array[0][0] === 1. Actual: ' + (array[0][0]));
}
//CHECK#21
if (array[0][1] !== 2) {
$ERROR('#21: var array = [[1,2], [3], []]; array[0][1] === 2. Actual: ' + (array[0][1]));
}
//CHECK#22
if (array[1][0] !== 3) {
$ERROR('#722: var array = [[1,2], [3], []]; array[1][0] === 3. Actual: ' + (array[1][0]));
}

View File

@ -0,0 +1,27 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* it isn't clear what specific requirements of the specificaiton are being tested here. This test should
* probably be replaced by some more targeted tests. AllenWB
*
* @path ch11/11.1/11.1.5/11.1.5-0-1.js
* @description Object literal - get set property
*/
function testcase() {
var s1 = "In getter";
var s2 = "In setter";
var s3 = "Modified by setter";
eval("var o = {get foo(){ return s1;},set foo(arg){return s2 = s3}};");
if(o.foo !== s1)
return false;
o.foo=10;
if(s2 !== s3)
return false;
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,32 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* it isn't clear what specific requirements of the specificaiton are being tested here. This test should
* probably be replaced by some more targeted tests. AllenWB
*
* @path ch11/11.1/11.1.5/11.1.5-0-2.js
* @description Object literal - multiple get set properties
*/
function testcase() {
var s1 = "First getter";
var s2 = "First setter";
var s3 = "Second getter";
eval("var o = {get foo(){ return s1;},set foo(arg){return s2 = s3}, get bar(){ return s3}, set bar(arg){ s3 = arg;}};");
if(o.foo !== s1)
return false;
o.foo = 10;
if(s2 !== s3)
return false;
if(o.bar !== s3)
return false;
o.bar = "Second setter";
if(o.bar !== "Second setter")
return false;
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,23 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5-1-s.js
* @description Strict Mode - SyntaxError is thrown when 'eval' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
* @onlyStrict
*/
function testcase() {
"use strict";
try {
eval("var obj = {set _11_1_5_1_fun(eval) {}};");
return false;
} catch (e) {
return (e instanceof SyntaxError);
}
}
runTestCase(testcase);

View File

@ -0,0 +1,14 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5-1gs.js
* @description Strict Mode - SyntaxError is thrown when 'eval' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
* @onlyStrict
* @negative ^((?!NotEarlyError).)*$
*/
"use strict";
throw NotEarlyError;
var obj = { set _11_1_5_1_fun(eval) {}};

View File

@ -0,0 +1,23 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5-2-s.js
* @description Strict Mode - SyntaxError is thrown when 'arguments' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
* @onlyStrict
*/
function testcase() {
"use strict";
try {
eval("var obj = {set _11_1_5_2_fun(arguments) {} };");
return false;
} catch (e) {
return (e instanceof SyntaxError);
}
}
runTestCase(testcase);

View File

@ -0,0 +1,14 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5-2gs.js
* @description Strict Mode - SyntaxError is thrown when eval code contains an ObjectLiteral with more than one definition of any data property
* @onlyStrict
* @negative ^((?!NotEarlyError).)*$
*/
"use strict";
throw NotEarlyError;
var obj = { _11_1_5_2_gs: 10, _11_1_5_2_gs: 10 };

View File

@ -0,0 +1,22 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5-3-s.js
* @description Strict Mode - SyntaxError is thrown when 'evals' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment if its FunctionBody is strict code
* @onlyStrict
*/
function testcase() {
try {
eval("var obj = {set _11_1_5_3_fun(eval) { \"use strict\"; }};");
return false;
} catch (e) {
return (e instanceof SyntaxError);
}
}
runTestCase(testcase);

View File

@ -0,0 +1,31 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true
*
* @path ch11/11.1/11.1.5/11.1.5-4-4-a-1-s.js
* @description Object literal - SyntaxError for duplicate date property name in strict mode
* @onlyStrict
*/
function testcase() {
try
{
eval("'use strict'; ({foo:0,foo:1});");
return false;
}
catch(e)
{
return (e instanceof SyntaxError);
}
}
runTestCase(testcase);

View File

@ -0,0 +1,22 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5-4-s.js
* @description Strict Mode - SyntaxError is thrown when 'arguments' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment if its FunctionBody is strict code
* @onlyStrict
*/
function testcase() {
try {
eval("var obj = {set _11_1_5_4_fun(arguments) {\"use strict\";}};");
return false;
} catch (e) {
return (e instanceof SyntaxError);
}
}
runTestCase(testcase);

View File

@ -0,0 +1,31 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyAssignment
* 3.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false.
*
* @path ch11/11.1/11.1.5/11.1.5_3-3-1.js
* @description Object initialization using PropertyNameAndValueList (PropertyAssignment) when property (read-only) exists in Object.prototype (step 3)
*/
function testcase() {
try {
Object.defineProperty(Object.prototype, "prop", {
value: 100,
writable: false,
configurable: true
});
var obj = { prop: 12 };
return obj.hasOwnProperty("prop") && obj.prop === 12;
} finally {
delete Object.prototype.prop;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,23 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-a-2.js
* @description Object literal - Duplicate data property name allowed if not in strict mode
*/
function testcase() {
eval("({foo:0,foo:1});");
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,23 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-a-3.js
* @description Object literal - Duplicate data property name allowed gets last defined value
*/
function testcase() {
var o = eval("({foo:0,foo:1});");
return o.foo===1;
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-b-1.js
* @description Object literal - SyntaxError if a data property definition is followed by get accessor definition with the same name
*/
function testcase() {
try
{
eval("({foo : 1, get foo(){}});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-b-2.js
* @description Object literal - SyntaxError if a data property definition is followed by set accessor definition with the same name
*/
function testcase() {
try
{
eval("({foo : 1, set foo(x){}});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-c-1.js
* @description Object literal - SyntaxError if a get accessor property definition is followed by a data property definition with the same name
*/
function testcase() {
try
{
eval("({get foo(){}, foo : 1});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-c-2.js
* @description Object literal - SyntaxError if a set accessor property definition is followed by a data property definition with the same name
*/
function testcase() {
try
{
eval("({set foo(x){}, foo : 1});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-d-1.js
* @description Object literal - SyntaxError for duplicate property name (get,get)
*/
function testcase() {
try
{
eval("({get foo(){}, get foo(){}});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-d-2.js
* @description Object literal - SyntaxError for duplicate property name (set,set)
*/
function testcase() {
try
{
eval("({set foo(arg){}, set foo(arg1){}});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-d-3.js
* @description Object literal - SyntaxError for duplicate property name (get,set,get)
*/
function testcase() {
try
{
eval("({get foo(){}, set foo(arg){}, get foo(){}});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
* d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*
* @path ch11/11.1/11.1.5/11.1.5_4-4-d-4.js
* @description Object literal - SyntaxError for duplicate property name (set,get,set)
*/
function testcase() {
try
{
eval("({set foo(arg){}, get foo(){}, set foo(arg1){}});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,32 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
* 5.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false.
*
* @path ch11/11.1/11.1.5/11.1.5_4-5-1.js
* @description Object initialization using PropertyNameAndValueList (PropertyNameAndValueList , PropertyAssignment) when property (read-only) exists in Object.prototype (Step 5)
*/
function testcase() {
try {
Object.defineProperty(Object.prototype, "prop2", {
value: 100,
writable: false,
configurable: true
});
var obj = { prop1: 101, prop2: 12 };
return obj.hasOwnProperty("prop2");
} finally {
delete Object.prototype.prop2;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,27 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyAssignment : PropertyName : AssignmentExpression
* 4.Let desc be the Property Descriptor{[[Value]]: propValue, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}
*
* @path ch11/11.1/11.1.5/11.1.5_5-4-1.js
* @description Object literal - property descriptor for assignment expression
*/
function testcase() {
var o = {foo : 1};
var desc = Object.getOwnPropertyDescriptor(o,"foo");
if(desc.value === 1 &&
desc.writable === true &&
desc.enumerable === true &&
desc.configurable === true)
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,30 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5_6-2-1-s.js
* @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word or a future reserved word is contained in strict code
* @onlyStrict
*/
function testcase() {
"use strict";
try {
eval("var obj = {\
get _11_1_5_6_2_1() {\
public = 42;\
return public;\
}\
};");
var _11_1_5_6_2_1 = obj._11_1_5_6_2_1;
return false;
} catch (e) {
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,29 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5_6-2-2-s.js
* @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word or a future reserved word is made inside a strict mode FunctionBody of a PropertyAssignment
* @onlyStrict
*/
function testcase() {
try {
eval("var obj = {\
get _11_1_5_6_2_2() {\
\"use strict\";\
public = 42;\
return public;\
}\
};\
var _11_1_5_6_2_2 = obj._11_1_5_6_2_2;");
return false;
} catch (e) {
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,25 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyAssignment : get PropertyName ( ) { FunctionBody }
* 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
*
* @path ch11/11.1/11.1.5/11.1.5_6-3-1.js
* @description Object literal - property descriptor for get property assignment
*/
function testcase() {
eval("var o = {get foo(){return 1;}};");
var desc = Object.getOwnPropertyDescriptor(o,"foo");
if(desc.enumerable === true &&
desc.configurable === true)
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,23 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyAssignment : get PropertyName ( ) { FunctionBody }
* 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
*
* @path ch11/11.1/11.1.5/11.1.5_6-3-2.js
* @description Object literal - property descriptor for get property assignment should not create a set function
*/
function testcase() {
eval("var o = {get foo(){return 1;}};");
var desc = Object.getOwnPropertyDescriptor(o,"foo");
return desc.set === undefined
}
runTestCase(testcase);

View File

@ -0,0 +1,30 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5_7-2-1-s.js
* @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word is contained in strict code
* @onlyStrict
*/
function testcase() {
"use strict";
try {
eval("var data = \"data\";\
var obj = {\
set _11_1_5_7_2_1(value) {\
public = 42;\
data = value;\
}\
};\
obj._11_1_5_7_2_1 = 1;");
return false;
} catch (e) {
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,30 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch11/11.1/11.1.5/11.1.5_7-2-2-s.js
* @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word is made in a strict FunctionBody of a PropertyAssignment
* @onlyStrict
*/
function testcase() {
"use strict";
try {
eval("var data = \"data\";\
var obj = {\
set _11_1_5_7_2_2(value) {\
public = 42;\
data = value;\
}\
};\
obj._11_1_5_7_2_2 = 1;");
return false;
} catch (e) {
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -0,0 +1,25 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyAssignment : set PropertyName( PropertySetParameterList ) { FunctionBody }
* 3.Let desc be the Property Descriptor{[[Set]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
*
* @path ch11/11.1/11.1.5/11.1.5_7-3-1.js
* @description Object literal - property descriptor for set property assignment
*/
function testcase() {
eval("var o = {set foo(arg){return 1;}};");
var desc = Object.getOwnPropertyDescriptor(o,"foo");
if(desc.enumerable === true &&
desc.configurable === true)
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,23 @@
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* Refer 11.1.5;
* The production
* PropertyAssignment : get PropertyName ( ) { FunctionBody }
* 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
*
* @path ch11/11.1/11.1.5/11.1.5_7-3-2.js
* @description Object literal - property descriptor for set property assignment should not create a get function
*/
function testcase() {
eval("var o = {set foo(arg){}};");
var desc = Object.getOwnPropertyDescriptor(o,"foo");
return desc.get === undefined
}
runTestCase(testcase);

View File

@ -0,0 +1,32 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ObjectLiteral: { }
*
* @path ch11/11.1/11.1.5/S11.1.5_A1.1.js
* @description Checking various properteis of the object defined with "var object = {}"
*/
var object = {};
//CHECK#1
if (typeof object !== "object") {
$ERROR('#1: var object = {}; typeof object === "object". Actual: ' + (typeof object));
}
//CHECK#2
if (object instanceof Object !== true) {
$ERROR('#2: var object = {}; object instanceof Object === true');
}
//CHECK#3
if (object.toString !== Object.prototype.toString) {
$ERROR('#3: var object = {}; object.toString === Object.prototype.toString. Actual: ' + (object.toString));
}
//CHECK#4
if (object.toString() !== "[object Object]") {
$ERROR('#4: var object = {}; object.toString === "[object Object]". Actual: ' + (object.toString));
}

View File

@ -0,0 +1,38 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ObjectLiteral: { NumericLiteral : AssignmentExpression}
*
* @path ch11/11.1/11.1.5/S11.1.5_A1.2.js
* @description Checking various properteis and contents of the object defined with "var object = {1 : true}"
*/
var object = {1 : true};
//CHECK#1
if (typeof object !== "object") {
$ERROR('#1: var object = {1 : true}; typeof object === "object". Actual: ' + (typeof object));
}
//CHECK#2
if (object instanceof Object !== true) {
$ERROR('#2: var object = {1 : true}; object instanceof Object === true');
}
//CHECK#3
if (object.toString !== Object.prototype.toString) {
$ERROR('#3: var object = {1 : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString));
}
//CHECK#4
if (object[1] !== true) {
$ERROR('#4: var object = {1 : true}; object[1] === true');
}
//CHECK#5
if (object["1"] !== true) {
$ERROR('#5: var object = {1 : true}; object["1"] === true');
}

View File

@ -0,0 +1,37 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ObjectLiteral: { StringLiteral : AssignmentExpression}
*
* @path ch11/11.1/11.1.5/S11.1.5_A1.3.js
* @description Checking various properteis and contents of the object defined with "var object = {"x" : true}"
*/
var object = {"x" : true};
//CHECK#1
if (typeof object !== "object") {
$ERROR('#1: var object = {"x" : true}; typeof object === "object". Actual: ' + (typeof object));
}
//CHECK#2
if (object instanceof Object !== true) {
$ERROR('#2: var object = {"x" : true}; object instanceof Object === true');
}
//CHECK#3
if (object.toString !== Object.prototype.toString) {
$ERROR('#3: var object = {"x" : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString));
}
//CHECK#4
if (object["x"] !== true) {
$ERROR('#4: var object = {"x" : true}; object["x"] === true');
}
//CHECK#5
if (object.x !== true) {
$ERROR('#5: var object = {"x" : true}; object.x === true');
}

View File

@ -0,0 +1,37 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ObjectLiteral: { Identifier : AssignmentExpression}
*
* @path ch11/11.1/11.1.5/S11.1.5_A1.4.js
* @description Checking various properteis and contents of the object defined with "var object = {prop : true}"
*/
var object = {prop : true};
//CHECK#1
if (typeof object !== "object") {
$ERROR('#1: var object = {prop : true}; typeof object === "object". Actual: ' + (typeof object));
}
//CHECK#2
if (object instanceof Object !== true) {
$ERROR('#2: var object = {prop : true}; object instanceof Object === true');
}
//CHECK#3
if (object.toString !== Object.prototype.toString) {
$ERROR('#3: var object = {prop : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString));
}
//CHECK#4
if (object["prop"] !== true) {
$ERROR('#4: var object = {prop : true}; object["prop"] === true');
}
//CHECK#5
if (object.prop !== true) {
$ERROR('#5: var object = {prop : true}; object.prop === true');
}

View File

@ -0,0 +1,94 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ObjectLiteral: { PropertyName : AssignmentExpression }
*
* @path ch11/11.1/11.1.5/S11.1.5_A2.js
* @description Creating property "prop" of various types(boolean, number and etc.)
*/
//CHECK#1
var x = true;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#1: var x = true; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#2
var x = new Boolean(true);
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#2: var x = new Boolean(true); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#3
var x = 1;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#3: var x = 1; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#4
var x = new Number(1);
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#4: var x = new Number(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#5
var x = "1";
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#5: var x = "1"; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#6
var x = new String(1);
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#6: var x = new String(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#7
var x = undefined;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#7: var x = undefined; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#8
var x = null;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#8: var x = null; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#9
var x = {};
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#9: var x = {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#10
var x = [1,2];
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#10: var x = [1,2]; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#11
var x = function() {};
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#11: var x = function() {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}
//CHECK#12
var x = this;
var object = {prop : x};
if (object.prop !== x) {
$ERROR('#12: var x = this; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));
}

View File

@ -0,0 +1,27 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Evaluate the production ObjectLiteral: { PropertyNameAndValueList }
*
* @path ch11/11.1/11.1.5/S11.1.5_A3.js
* @description Creating the object defined with "var object = {0 : 1, "1" : "x", o : {}}"
*/
var object = {0 : 1, "1" : "x", o : {}};
//CHECK#1
if (object[0] !== 1) {
$ERROR('#1: var object = {0 : 1; "1" : "x"; o : {}}; object[0] === 1. Actual: ' + (object[0]));
}
//CHECK#2
if (object["1"] !== "x") {
$ERROR('#2: var object = {0 : 1; "1" : "x"; o : {}}; object["1"] === "x". Actual: ' + (object["1"]));
}
//CHECK#3
if (typeof object.o !== "object") {
$ERROR('#1: var object = {0 : 1; "1" : "x"; o : {}}; typeof object.o === "object". Actual: ' + (typeof object.o));
}

View File

@ -0,0 +1,13 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* The PropertyName is not really a BooleanLiteral
*
* @path ch11/11.1/11.1.5/S11.1.5_A4.1.js
* @description Checking if execution of "var object = {true : 1}" does not fail
*/
//CHECK#1
var object = {true : 1};

View File

@ -0,0 +1,12 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* The PropertyName is not really a nullLiteral
*
* @path ch11/11.1/11.1.5/S11.1.5_A4.2.js
* @description Checking if execution of "var object = {null : true}" does not fail
*/
//CHECK#1
var object = {null : true};

View File

@ -0,0 +1,34 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* The PropertyName is undefined, ToString(BooleanLiteral), ToString(nullLiteral)
*
* @path ch11/11.1/11.1.5/S11.1.5_A4.3.js
* @description Creating properties with following names: undefined, 'true', 'null'
*/
//CHECK#1
var object = {undefined : true};
if (object.undefined !== true) {
$ERROR('#1: var object = {undefined : true}; object.undefined === true');
}
//CHECK#2
var object = {undefined : true};
if (object["undefined"] !== true) {
$ERROR('#2: var object = {undefined : true}; object["undefined"] === true');
}
//CHECK#3
var object = {"true" : true};
if (object["true"] !== true) {
$ERROR('#3: var object = {"true" : true}; object["true"] === true');
}
//CHECK#4
var object = {"null" : true};
if (object["null"] !== true) {
$ERROR('#4: var object = {"null" : true}; object["null"] === true');
}

View File

@ -0,0 +1,60 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* White Space and Line Terminator inside "grouping" operator are allowed
*
* @path ch11/11.1/11.1.6/S11.1.6_A1.js
* @description Inserting WhiteSpaces and LineTerminators into grouping operator. Eval is used
*/
//CHECK#1
if (eval("(\u00091\u0009)") !== 1) {
$ERROR('#1: (\\u00091\\u0009) === 1');
}
//CHECK#2
if (eval("(\u000B1\u000B)") !== 1) {
$ERROR('#2: (\\u000B1\\u000B) === 1');
}
//CHECK#3
if (eval("(\u000C1\u000C)") !== 1) {
$ERROR('#3: (\\u000C1\\u000C) === 1');
}
//CHECK#4
if (eval("(\u00201\u0020)") !== 1) {
$ERROR('#4: (\\u00201\\u0020 === 1');
}
//CHECK#5
if (eval("(\u00A01\u00A0)") !== 1) {
$ERROR('#5: (\\u00A01\\u00A0) === 1');
}
//CHECK#6
if (eval("(\u000A1\u000A)") !== 1) {
$ERROR('#6: (\\u000A1\\u000A) === 1');
}
//CHECK#7
if (eval("(\u000D1\u000D)") !== 1) {
$ERROR('#7: (\\u000D1\\u000D) === 1');
}
//CHECK#8
if (eval("(\u20281\u2028)") !== 1) {
$ERROR('#8: (\\u20281\\u2028) === 1');
}
//CHECK#9
if (eval("(\u20291\u2029)") !== 1) {
$ERROR('#9: (\\u20291\\u2029) === 1');
}
//CHECK#10
if (eval("(\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029)") !== 1) {
$ERROR('#10: (\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029) === 1');
}

View File

@ -0,0 +1,31 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* "This" operator doesn't use GetValue. The operators "delete" and "typeof" can be applied to parenthesised expressions
*
* @path ch11/11.1/11.1.6/S11.1.6_A2.js
* @description Applying "delete" and "typeof" operators to an undefined variable and a property of an object
*/
//CHECK#1
if (delete (x) !== true) {
$ERROR('#1: delete (x) === true');
}
//CHECK#2
if (typeof (x) !== "undefined") {
$ERROR('#2: typeof (x) === "undefined". Actual: ' + (typeof (x)));
}
var object = {};
//CHECK#3
if (delete (object.prop) !== true) {
$ERROR('#3: var object = {}; delete (object.prop) === true');
}
//CHECK#4
if (typeof (object.prop) !== "undefined") {
$ERROR('#4: var object = {}; typeof (object.prop) === "undefined". Actual: ' + (typeof (object.prop)));
}

View File

@ -0,0 +1,23 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* "This" operator only evaluates Expression
*
* @path ch11/11.1/11.1.6/S11.1.6_A3_T1.js
* @description Applying grouping operator to Boolean
*/
// Check for Boolean
//CHECK#1
if ((true) !== true) {
$ERROR('#1: (true) === true');
}
//CHECK#2
var x = new Boolean(true);
if ((x) !== x) {
$ERROR('#2: var x = new Boolean(true); (x) === x. Actual: ' + ((x)));
}

View File

@ -0,0 +1,23 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* "This" operator only evaluates Expression
*
* @path ch11/11.1/11.1.6/S11.1.6_A3_T2.js
* @description Applying grouping operator to Number
*/
//Check for Number
//CHECK#1
if ((1) !== 1) {
$ERROR('#1: (1) === 1. Actual: ' + ((1)));
}
//CHECK#2
var x = new Number(1);
if ((x) !== x) {
$ERROR('#2: var x = new Number(1); (x) === x. Actual: ' + ((x)));
}

View File

@ -0,0 +1,28 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* "This" operator only evaluates Expression
*
* @path ch11/11.1/11.1.6/S11.1.6_A3_T3.js
* @description Applying grouping operator to String
*/
//Check for String
//CHECK#1
if (("1") !== "1") {
$ERROR('#1: ("1") === "1". Actual: ' + (("1")));
}
//CHECK#2
if (("x") !== "x") {
$ERROR('#2: ("x") === "x". Actual: ' + (("x")));
}
//CHECK#3
var x = new Number("1");
if ((x) !== x) {
$ERROR('#3: var x = new Number("1"); (x) === x. Actual: ' + ((x)));
}

View File

@ -0,0 +1,27 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* "This" operator only evaluates Expression
*
* @path ch11/11.1/11.1.6/S11.1.6_A3_T4.js
* @description Applying grouping operator to undefined
*/
//Check for undefined and null
//CHECK#1
if ((undefined) !== undefined) {
$ERROR('#1: (undefined) === undefined. Actual: ' + ((undefined)));
}
//CHECK#2
if ((void 0) !== void 0) {
$ERROR('#2: (void 0) === void 0. Actual: ' + ((void 0)));
}
//CHECK#2
if ((null) !== null) {
$ERROR('#2: (null) === null. Actual: ' + ((null)));
}

View File

@ -0,0 +1,22 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* "This" operator only evaluates Expression
*
* @path ch11/11.1/11.1.6/S11.1.6_A3_T5.js
* @description Using grouping operator in declaration of variables
*/
//CHECK#1
(x) = 1;
if (x !== 1) {
$ERROR('#1: (x) = 1; x === 1. Actual: ' + (x));
}
//CHECK#2
var y = 1; (y)++; ++(y); (y)--; --(y);
if (y !== 1) {
$ERROR('#2: var y = 1; (y)++; ++(y); (y)--; --(y); y === 1. Actual: ' + (y));
}

View File

@ -0,0 +1,20 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* "This" operator only evaluates Expression
*
* @path ch11/11.1/11.1.6/S11.1.6_A3_T6.js
* @description Applying grouping operator to delete and typeof operators
*/
//CHECK#1
if (delete (x) !== true) {
$ERROR('#1: delete (x) === true');
}
//CHECK#2
if (typeof (x) !== "undefined") {
$ERROR('#2: typeof (x) === "undefined". Actual: ' + (typeof (x)));
}

View File

View File

@ -0,0 +1,61 @@
// 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 BitwiseANDExpression and "&" or between "&" and EqualityExpression are allowed
*
* @path ch11/11.10/11.10.1/S11.10.1_A1.js
* @description Checking uses eval
*/
//CHECK#1
if ((eval("1\u0009&\u00091")) !== 1) {
$ERROR('#1: (1\\u0009&\\u00091) === 1');
}
//CHECK#2
if ((eval("1\u000B&\u000B1")) !== 1) {
$ERROR('#2: (1\\u000B&\\u000B1) === 1');
}
//CHECK#3
if ((eval("1\u000C&\u000C1")) !== 1) {
$ERROR('#3: (1\\u000C&\\u000C1) === 1');
}
//CHECK#4
if ((eval("1\u0020&\u00201")) !== 1) {
$ERROR('#4: (1\\u0020&\\u00201) === 1');
}
//CHECK#5
if ((eval("1\u00A0&\u00A01")) !== 1) {
$ERROR('#5: (1\\u00A0&\\u00A01) === 1');
}
//CHECK#6
if ((eval("1\u000A&\u000A1")) !== 1) {
$ERROR('#6: (1\\u000A&\\u000A1) === 1');
}
//CHECK#7
if ((eval("1\u000D&\u000D1")) !== 1) {
$ERROR('#7: (1\\u000D&\\u000D1) === 1');
}
//CHECK#8
if ((eval("1\u2028&\u20281")) !== 1) {
$ERROR('#8: (1\\u2028&\\u20281) === 1');
}
//CHECK#9
if ((eval("1\u2029&\u20291")) !== 1) {
$ERROR('#9: (1\\u2029&\\u20291) === 1');
}
//CHECK#10
if ((eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029&\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 1) {
$ERROR('#10: (1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029&\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 1');
}

View File

@ -0,0 +1,43 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Operator x & y uses GetValue
*
* @path ch11/11.10/11.10.1/S11.10.1_A2.1_T1.js
* @description Either Type is not Reference or GetBase is not null
*/
//CHECK#1
if ((1 & 1) !== 1) {
$ERROR('#1: (1 & 1) === 1. Actual: ' + ((1 & 1)));
}
//CHECK#2
var x = 1;
if ((x & 1) !== 1) {
$ERROR('#2: var x = 1; (x & 1) === 1. Actual: ' + ((x & 1)));
}
//CHECK#3
var y = 1;
if ((1 & y) !== 1) {
$ERROR('#3: var y = 1; (1 & y) === 1. Actual: ' + ((1 & y)));
}
//CHECK#4
var x = 1;
var y = 1;
if ((x & y) !== 1) {
$ERROR('#4: var x = 1; var y = 1; (x & y) === 1. Actual: ' + ((x & y)));
}
//CHECK#5
var objectx = new Object();
var objecty = new Object();
objectx.prop = 1;
objecty.prop = 1;
if ((objectx.prop & objecty.prop) !== 1) {
$ERROR('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; (objectx.prop & objecty.prop) === 1. Actual: ' + ((objectx.prop & objecty.prop)));
}

View File

@ -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.
/**
* Operator x & y uses GetValue
*
* @path ch11/11.10/11.10.1/S11.10.1_A2.1_T2.js
* @description If GetBase(x) is null, throw ReferenceError
*/
//CHECK#1
try {
x & 1;
$ERROR('#1.1: x & 1 throw ReferenceError. Actual: ' + (x & 1));
}
catch (e) {
if ((e instanceof ReferenceError) !== true) {
$ERROR('#1.2: x & 1 throw ReferenceError. Actual: ' + (e));
}
}

View File

@ -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.
/**
* Operator x & y uses GetValue
*
* @path ch11/11.10/11.10.1/S11.10.1_A2.1_T3.js
* @description If GetBase(y) is null, throw ReferenceError
*/
//CHECK#1
try {
1 & y;
$ERROR('#1.1: 1 & y throw ReferenceError. Actual: ' + (1 & y));
}
catch (e) {
if ((e instanceof ReferenceError) !== true) {
$ERROR('#1.2: 1 & y throw ReferenceError. Actual: ' + (e));
}
}

View File

@ -0,0 +1,71 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Operator x & y uses [[Default Value]]
*
* @path ch11/11.10/11.10.1/S11.10.1_A2.2_T1.js
* @description If Type(value) is Object, evaluate ToPrimitive(value, Number)
*/
//CHECK#1
if (({valueOf: function() {return 1}} & 1) !== 1) {
$ERROR('#1: ({valueOf: function() {return 1}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}} & 1)));
}
//CHECK#2
if (({valueOf: function() {return 1}, toString: function() {return 0}} & 1) !== 1) {
$ERROR('#2: ({valueOf: function() {return 1}, toString: function() {return 0}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return 0}} & 1)));
}
//CHECK#3
if (({valueOf: function() {return 1}, toString: function() {return {}}} & 1) !== 1) {
$ERROR('#3: ({valueOf: function() {return 1}, toString: function() {return {}}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return {}}} & 1)));
}
//CHECK#4
try {
if (({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) !== 1) {
$ERROR('#4.1: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1)));
}
}
catch (e) {
if (e === "error") {
$ERROR('#4.2: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) not throw "error"');
} else {
$ERROR('#4.3: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) not throw Error. Actual: ' + (e));
}
}
//CHECK#5
if ((1 & {toString: function() {return 1}}) !== 1) {
$ERROR('#5.1: (1 & {toString: function() {return 1}}) === 1. Actual: ' + ((1 & {toString: function() {return 1}})));
}
//CHECK#6
if ((1 & {valueOf: function() {return {}}, toString: function() {return 1}}) !== 1) {
$ERROR('#6: (1 & {valueOf: function() {return {}}, toString: function() {return 1}}) === 1. Actual: ' + ((1 & {valueOf: function() {return {}}, toString: function() {return 1}})));
}
//CHECK#7
try {
1 & {valueOf: function() {throw "error"}, toString: function() {return 1}};
$ERROR('#7.1: 1 & {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 & {valueOf: function() {throw "error"}, toString: function() {return 1}}));
}
catch (e) {
if (e !== "error") {
$ERROR('#7.2: 1 & {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e));
}
}
//CHECK#8
try {
1 & {valueOf: function() {return {}}, toString: function() {return {}}};
$ERROR('#8.1: 1 & {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 & {valueOf: function() {return {}}, toString: function() {return {}}}));
}
catch (e) {
if ((e instanceof TypeError) !== true) {
$ERROR('#8.2: 1 & {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e));
}
}

View File

@ -0,0 +1,26 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* ToInt32(first expression) is called first, and then ToInt32(second expression)
*
* @path ch11/11.10/11.10.1/S11.10.1_A2.3_T1.js
* @description Checking by using "throw"
*/
//CHECK#1
var x = { valueOf: function () { throw "x"; } };
var y = { valueOf: function () { throw "y"; } };
try {
x & y;
$ERROR('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x & y throw "x". Actual: ' + (x & y));
} catch (e) {
if (e === "y") {
$ERROR('#1.2: ToInt32(first expression) is called first, and then ToInt32(second expression)');
} else {
if (e !== "x") {
$ERROR('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x & y throw "x". Actual: ' + (e));
}
}
}

View File

@ -0,0 +1,23 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* First expression is evaluated first, and then second expression
*
* @path ch11/11.10/11.10.1/S11.10.1_A2.4_T1.js
* @description Checking with "="
*/
//CHECK#1
var x = 0;
if (((x = 1) & x) !== 1) {
$ERROR('#1: var x = 0; ((x = 1) & x) === 1. Actual: ' + (((x = 1) & x)));
}
//CHECK#2
var x = 0;
if ((x & (x = 1)) !== 0) {
$ERROR('#2: var x = 0; (x & (x = 1)) === 0. Actual: ' + ((x & (x = 1))));
}

View File

@ -0,0 +1,26 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* First expression is evaluated first, and then second expression
*
* @path ch11/11.10/11.10.1/S11.10.1_A2.4_T2.js
* @description Checking with "throw"
*/
//CHECK#1
var x = function () { throw "x"; };
var y = function () { throw "y"; };
try {
x() & y();
$ERROR('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() & y() throw "x". Actual: ' + (x() & y()));
} catch (e) {
if (e === "y") {
$ERROR('#1.2: First expression is evaluated first, and then second expression');
} else {
if (e !== "x") {
$ERROR('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() & y() throw "x". Actual: ' + (e));
}
}
}

View File

@ -0,0 +1,28 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* First expression is evaluated first, and then second expression
*
* @path ch11/11.10/11.10.1/S11.10.1_A2.4_T3.js
* @description Checking with undeclarated variables
* @noStrict
*/
//CHECK#1
try {
x & (x = 1);
$ERROR('#1.1: x & (x = 1) throw ReferenceError. Actual: ' + (x & (x = 1)));
}
catch (e) {
if ((e instanceof ReferenceError) !== true) {
$ERROR('#1.2: x & (x = 1) throw ReferenceError. Actual: ' + (e));
}
}
//CHECK#2
if (((y = 1) & y) !== 1) {
$ERROR('#2: ((y = 1) & y) === 1. Actual: ' + (((y = 1) & y)));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T1.1.js
* @description Type(x) and Type(y) are primitive boolean and Boolean object
*/
//CHECK#1
if ((true & true) !== 1) {
$ERROR('#1: (true & true) === 1. Actual: ' + ((true & true)));
}
//CHECK#2
if ((new Boolean(true) & true) !== 1) {
$ERROR('#2: (new Boolean(true) & true) === 1. Actual: ' + ((new Boolean(true) & true)));
}
//CHECK#3
if ((true & new Boolean(true)) !== 1) {
$ERROR('#3: (true & new Boolean(true)) === 1. Actual: ' + ((true & new Boolean(true))));
}
//CHECK#4
if ((new Boolean(true) & new Boolean(true)) !== 1) {
$ERROR('#4: (new Boolean(true) & new Boolean(true)) === 1. Actual: ' + ((new Boolean(true) & new Boolean(true))));
}

View File

@ -0,0 +1,31 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T1.2.js
* @description Type(x) and Type(y) are primitive number and Number object
*/
//CHECK#1
if ((1 & 1) !== 1) {
$ERROR('#1: (1 & 1) === 1. Actual: ' + ((1 & 1)));
}
//CHECK#2
if ((new Number(1) & 1) !== 1) {
$ERROR('#2: (new Number(1) & 1) === 1. Actual: ' + ((new Number(1) & 1)));
}
//CHECK#3
if ((1 & new Number(1)) !== 1) {
$ERROR('#3: (1 & new Number(1)) === 1. Actual: ' + ((1 & new Number(1))));
}
//CHECK#4
if ((new Number(1) & new Number(1)) !== 1) {
$ERROR('#4: (new Number(1) & new Number(1)) === 1. Actual: ' + ((new Number(1) & new Number(1))));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T1.3.js
* @description Type(x) and Type(y) are primitive string and String object
*/
//CHECK#1
if (("1" & "1") !== 1) {
$ERROR('#1: ("1" & "1") === 1. Actual: ' + (("1" & "1")));
}
//CHECK#2
if ((new String("1") & "1") !== 1) {
$ERROR('#2: (new String("1") & "1") === 1. Actual: ' + ((new String("1") & "1")));
}
//CHECK#3
if (("1" & new String("1")) !== 1) {
$ERROR('#3: ("1" & new String("1")) === 1. Actual: ' + (("1" & new String("1"))));
}
//CHECK#4
if ((new String("1") & new String("1")) !== 1) {
$ERROR('#4: (new String("1") & new String("1")) === 1. Actual: ' + ((new String("1") & new String("1"))));
}
//CHECK#5
if (("x" & "1") !== 0) {
$ERROR('#5: ("x" & "1") === 0. Actual: ' + (("x" & "1")));
}
//CHECK#6
if (("1" & "x") !== 0) {
$ERROR('#6: ("1" & "x") === 0. Actual: ' + (("1" & "x")));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T1.4.js
* @description Type(x) and Type(y) are null and undefined
*/
//CHECK#1
if ((null & undefined) !== 0) {
$ERROR('#1: (null & undefined) === 0. Actual: ' + ((null & undefined)));
}
//CHECK#2
if ((undefined & null) !== 0) {
$ERROR('#2: (undefined & null) === 0. Actual: ' + ((undefined & null)));
}
//CHECK#3
if ((undefined & undefined) !== 0) {
$ERROR('#3: (undefined & undefined) === 0. Actual: ' + ((undefined & undefined)));
}
//CHECK#4
if ((null & null) !== 0) {
$ERROR('#4: (null & null) === 0. Actual: ' + ((null & null)));
}

View File

@ -0,0 +1,31 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T1.5.js
* @description Type(x) and Type(y) are Object object and Function object
*/
//CHECK#1
if (({} & function(){return 1}) !== 0) {
$ERROR('#1: ({} & function(){return 1}) === 0. Actual: ' + (({} & function(){return 1})));
}
//CHECK#2
if ((function(){return 1} & {}) !== 0) {
$ERROR('#2: (function(){return 1} & {}) === 0. Actual: ' + ((function(){return 1} & {})));
}
//CHECK#3
if ((function(){return 1} & function(){return 1}) !== 0) {
$ERROR('#3: (function(){return 1} & function(){return 1}) === 0. Actual: ' + ((function(){return 1} & function(){return 1})));
}
//CHECK#4
if (({} & {}) !== 0) {
$ERROR('#4: ({} & {}) === 0. Actual: ' + (({} & {})));
}

View File

@ -0,0 +1,50 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T2.1.js
* @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Boolean (primitive and object)
*/
//CHECK#1
if ((true & 1) !== 1) {
$ERROR('#1: (true & 1) === 1. Actual: ' + ((true & 1)));
}
//CHECK#2
if ((1 & true) !== 1) {
$ERROR('#2: (1 & true) === 1. Actual: ' + ((1 & true)));
}
//CHECK#3
if ((new Boolean(true) & 1) !== 1) {
$ERROR('#3: (new Boolean(true) & 1) === 1. Actual: ' + ((new Boolean(true) & 1)));
}
//CHECK#4
if ((1 & new Boolean(true)) !== 1) {
$ERROR('#4: (1 & new Boolean(true)) === 1. Actual: ' + ((1 & new Boolean(true))));
}
//CHECK#5
if ((true & new Number(1)) !== 1) {
$ERROR('#5: (true & new Number(1)) === 1. Actual: ' + ((true & new Number(1))));
}
//CHECK#6
if ((new Number(1) & true) !== 1) {
$ERROR('#6: (new Number(1) & true) === 1. Actual: ' + ((new Number(1) & true)));
}
//CHECK#7
if ((new Boolean(true) & new Number(1)) !== 1) {
$ERROR('#7: (new Boolean(true) & new Number(1)) === 1. Actual: ' + ((new Boolean(true) & new Number(1))));
}
//CHECK#8
if ((new Number(1) & new Boolean(true)) !== 1) {
$ERROR('#8: (new Number(1) & new Boolean(true)) === 1. Actual: ' + ((new Number(1) & new Boolean(true))));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T2.2.js
* @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and String (primitive and object)
*/
//CHECK#1
if (("1" & 1) !== 1) {
$ERROR('#1: ("1" & 1) === 1. Actual: ' + (("1" & 1)));
}
//CHECK#2
if ((1 & "1") !== 1) {
$ERROR('#2: (1 & "1") === 1. Actual: ' + ((1 & "1")));
}
//CHECK#3
if ((new String("1") & 1) !== 1) {
$ERROR('#3: (new String("1") & 1) === 1. Actual: ' + ((new String("1") & 1)));
}
//CHECK#4
if ((1 & new String("1")) !== 1) {
$ERROR('#4: (1 & new String("1")) === 1. Actual: ' + ((1 & new String("1"))));
}
//CHECK#5
if (("1" & new Number(1)) !== 1) {
$ERROR('#5: ("1" & new Number(1)) === 1. Actual: ' + (("1" & new Number(1))));
}
//CHECK#6
if ((new Number(1) & "1") !== 1) {
$ERROR('#6: (new Number(1) & "1") === 1. Actual: ' + ((new Number(1) & "1")));
}
//CHECK#7
if ((new String("1") & new Number(1)) !== 1) {
$ERROR('#7: (new String("1") & new Number(1)) === 1. Actual: ' + ((new String("1") & new Number(1))));
}
//CHECK#8
if ((new Number(1) & new String("1")) !== 1) {
$ERROR('#8: (new Number(1) & new String("1")) === 1. Actual: ' + ((new Number(1) & new String("1"))));
}
//CHECK#9
if (("x" & 1) !== 0) {
$ERROR('#9: ("x" & 1) === 0. Actual: ' + (("x" & 1)));
}
//CHECK#10
if ((1 & "x") !== 0) {
$ERROR('#10: (1 & "x") === 0. Actual: ' + ((1 & "x")));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T2.3.js
* @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Null
*/
//CHECK#1
if ((1 & null) !== 0) {
$ERROR('#1: (1 & null) === 0. Actual: ' + ((1 & null)));
}
//CHECK#2
if ((null & 1) !== 0) {
$ERROR('#2: (null & 1) === 0. Actual: ' + ((null & 1)));
}
//CHECK#3
if ((new Number(1) & null) !== 0) {
$ERROR('#3: (new Number(1) & null) === 0. Actual: ' + ((new Number(1) & null)));
}
//CHECK#4
if ((null & new Number(1)) !== 0) {
$ERROR('#4: (null & new Number(1)) === 0. Actual: ' + ((null & new Number(1))));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T2.4.js
* @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Undefined
*/
//CHECK#1
if ((1 & undefined) !== 0) {
$ERROR('#1: (1 & undefined) === 0. Actual: ' + ((1 & undefined)));
}
//CHECK#2
if ((undefined & 1) !== 0) {
$ERROR('#2: (undefined & 1) === 0. Actual: ' + ((undefined & 1)));
}
//CHECK#3
if ((new Number(1) & undefined) !== 0) {
$ERROR('#3: (new Number(1) & undefined) === 0. Actual: ' + ((new Number(1) & undefined)));
}
//CHECK#4
if ((undefined & new Number(1)) !== 0) {
$ERROR('#4: (undefined & new Number(1)) === 0. Actual: ' + ((undefined & new Number(1))));
}

View File

@ -0,0 +1,50 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T2.5.js
* @description Type(x) us different from Type(y) and both types are String (primitive or object) or Boolean (primitive and object)
*/
//CHECK#1
if ((true & "1") !== 1) {
$ERROR('#1: (true & "1") === 1. Actual: ' + ((true & "1")));
}
//CHECK#2
if (("1" & true) !== 1) {
$ERROR('#2: ("1" & true) === 1. Actual: ' + (("1" & true)));
}
//CHECK#3
if ((new Boolean(true) & "1") !== 1) {
$ERROR('#3: (new Boolean(true) & "1") === 1. Actual: ' + ((new Boolean(true) & "1")));
}
//CHECK#4
if (("1" & new Boolean(true)) !== 1) {
$ERROR('#4: ("1" & new Boolean(true)) === 1. Actual: ' + (("1" & new Boolean(true))));
}
//CHECK#5
if ((true & new String("1")) !== 1) {
$ERROR('#5: (true & new String("1")) === 1. Actual: ' + ((true & new String("1"))));
}
//CHECK#6
if ((new String("1") & true) !== 1) {
$ERROR('#6: (new String("1") & true) === 1. Actual: ' + ((new String("1") & true)));
}
//CHECK#7
if ((new Boolean(true) & new String("1")) !== 1) {
$ERROR('#7: (new Boolean(true) & new String("1")) === 1. Actual: ' + ((new Boolean(true) & new String("1"))));
}
//CHECK#8
if ((new String("1") & new Boolean(true)) !== 1) {
$ERROR('#8: (new String("1") & new Boolean(true)) === 1. Actual: ' + ((new String("1") & new Boolean(true))));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T2.6.js
* @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Undefined
*/
//CHECK#1
if (("1" & undefined) !== 0) {
$ERROR('#1: ("1" & undefined) === 0. Actual: ' + (("1" & undefined)));
}
//CHECK#2
if ((undefined & "1") !== 0) {
$ERROR('#2: (undefined & "1") === 0. Actual: ' + ((undefined & "1")));
}
//CHECK#3
if ((new String("1") & undefined) !== 0) {
$ERROR('#3: (new String("1") & undefined) === 0. Actual: ' + ((new String("1") & undefined)));
}
//CHECK#4
if ((undefined & new String("1")) !== 0) {
$ERROR('#4: (undefined & new String("1")) === 0. Actual: ' + ((undefined & new String("1"))));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T2.7.js
* @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Null
*/
//CHECK#1
if (("1" & null) !== 0) {
$ERROR('#1: ("1" & null) === 0. Actual: ' + (("1" & null)));
}
//CHECK#2
if ((null & "1") !== 0) {
$ERROR('#2: (null & "1") === 0. Actual: ' + ((null & "1")));
}
//CHECK#3
if ((new String("1") & null) !== 0) {
$ERROR('#3: (new String("1") & null) === 0. Actual: ' + ((new String("1") & null)));
}
//CHECK#4
if ((null & new String("1")) !== 0) {
$ERROR('#4: (null & new String("1")) === 0. Actual: ' + ((null & new String("1"))));
}

View File

@ -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.
/**
* Operator x & y returns ToNumber(x) & ToNumber(y)
*
* @path ch11/11.10/11.10.1/S11.10.1_A3_T2.8.js
* @description Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Undefined
*/
//CHECK#1
if ((true & undefined) !== 0) {
$ERROR('#1: (true & undefined) === 0. Actual: ' + ((true & undefined)));
}
//CHECK#2
if ((undefined & true) !== 0) {
$ERROR('#2: (undefined & true) === 0. Actual: ' + ((undefined & true)));
}
//CHECK#3
if ((new Boolean(true) & undefined) !== 0) {
$ERROR('#3: (new Boolean(true) & undefined) === 0. Actual: ' + ((new Boolean(true) & undefined)));
}
//CHECK#4
if ((undefined & new Boolean(true)) !== 0) {
$ERROR('#4: (undefined & new Boolean(true)) === 0. Actual: ' + ((undefined & new Boolean(true))));
}

Some files were not shown because too many files have changed in this diff Show More