mirror of
https://github.com/tc39/test262.git
synced 2025-07-19 20:14:56 +02:00
Replace runTestCase with assert, try-finally
This commit is contained in:
parent
52a706c022
commit
bd603294cb
@ -6,19 +6,11 @@ es5id: 15.3.4.5-11-1
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - internal property [[Prototype]] of 'F'
|
Function.prototype.bind - internal property [[Prototype]] of 'F'
|
||||||
is set as Function.prototype
|
is set as Function.prototype
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
try {
|
|
||||||
Function.prototype.property = 12;
|
Function.prototype.property = 12;
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
|
|
||||||
return obj.property === 12;
|
assert.sameValue(obj.property, 12, 'obj.property');
|
||||||
} finally {
|
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,15 +6,12 @@ es5id: 15.3.4.5-6-10
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - F can get own accessor property without
|
Function.prototype.bind - F can get own accessor property without
|
||||||
a get function that overrides an inherited accessor property
|
a get function that overrides an inherited accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
|
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
|
||||||
Object.defineProperty(Function.prototype, "property", {
|
Object.defineProperty(Function.prototype, "property", {
|
||||||
get: function () {
|
get: function () {
|
||||||
return 3;
|
return 3;
|
||||||
@ -25,9 +22,5 @@ function testcase() {
|
|||||||
Object.defineProperty(obj, "property", {
|
Object.defineProperty(obj, "property", {
|
||||||
set: function () { }
|
set: function () { }
|
||||||
});
|
});
|
||||||
return typeof (obj.property) === "undefined";
|
|
||||||
} finally {
|
assert.sameValue(typeof (obj.property), "undefined", 'typeof (obj.property)');
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,22 +6,15 @@ es5id: 15.3.4.5-6-11
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - F can get inherited accessor property
|
Function.prototype.bind - F can get inherited accessor property
|
||||||
without a get function
|
without a get function
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
|
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
|
||||||
Object.defineProperty(Function.prototype, "property", {
|
Object.defineProperty(Function.prototype, "property", {
|
||||||
set: function () { },
|
set: function () { },
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
return typeof (obj.property) === "undefined";
|
|
||||||
} finally {
|
assert.sameValue(typeof (obj.property), "undefined", 'typeof (obj.property)');
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,12 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.3.4.5-6-2
|
es5id: 15.3.4.5-6-2
|
||||||
description: Function.prototype.bind - F can get inherited data property
|
description: Function.prototype.bind - F can get inherited data property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
|
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
|
||||||
Function.prototype.property = 12;
|
Function.prototype.property = 12;
|
||||||
return obj.property === 12;
|
|
||||||
} finally {
|
assert.sameValue(obj.property, 12, 'obj.property');
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,21 +6,13 @@ es5id: 15.3.4.5-6-3
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - F can get own data property that
|
Function.prototype.bind - F can get own data property that
|
||||||
overrides an inherited data property
|
overrides an inherited data property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
|
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
|
|
||||||
try {
|
|
||||||
Function.prototype.property = 3;
|
Function.prototype.property = 3;
|
||||||
obj.property = 12;
|
obj.property = 12;
|
||||||
return obj.property === 12;
|
|
||||||
} finally {
|
assert.sameValue(obj.property, 12, 'obj.property');
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,15 +6,12 @@ es5id: 15.3.4.5-6-4
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - F can get own data property that
|
Function.prototype.bind - F can get own data property that
|
||||||
overrides an inherited accessor property
|
overrides an inherited accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
|
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
|
||||||
Object.defineProperty(Function.prototype, "property", {
|
Object.defineProperty(Function.prototype, "property", {
|
||||||
get: function () {
|
get: function () {
|
||||||
return 3;
|
return 3;
|
||||||
@ -26,9 +23,4 @@ function testcase() {
|
|||||||
value: 12
|
value: 12
|
||||||
});
|
});
|
||||||
|
|
||||||
return obj.property === 12;
|
assert.sameValue(obj.property, 12, 'obj.property');
|
||||||
} finally {
|
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.3.4.5-6-6
|
es5id: 15.3.4.5-6-6
|
||||||
description: Function.prototype.bind - F can get inherited accessor property
|
description: Function.prototype.bind - F can get inherited accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
|
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
|
||||||
Object.defineProperty(Function.prototype, "property", {
|
Object.defineProperty(Function.prototype, "property", {
|
||||||
get: function () {
|
get: function () {
|
||||||
return 12;
|
return 12;
|
||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
return obj.property === 12;
|
|
||||||
} finally {
|
assert.sameValue(obj.property, 12, 'obj.property');
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,24 +6,17 @@ es5id: 15.3.4.5-6-7
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - F can get own accessor property that
|
Function.prototype.bind - F can get own accessor property that
|
||||||
overrides an inherited data property
|
overrides an inherited data property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
|
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
|
||||||
Function.prototype.property = 3;
|
Function.prototype.property = 3;
|
||||||
Object.defineProperty(obj, "property", {
|
Object.defineProperty(obj, "property", {
|
||||||
get: function () {
|
get: function () {
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return obj.property === 12;
|
|
||||||
} finally {
|
assert.sameValue(obj.property, 12, 'obj.property');
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,15 +6,12 @@ es5id: 15.3.4.5-6-8
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - F can get own accessor property that
|
Function.prototype.bind - F can get own accessor property that
|
||||||
overrides an inherited accessor property
|
overrides an inherited accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var foo = function () { };
|
var foo = function () { };
|
||||||
|
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
|
||||||
Object.defineProperty(Function.prototype, "property", {
|
Object.defineProperty(Function.prototype, "property", {
|
||||||
get: function () {
|
get: function () {
|
||||||
return 3;
|
return 3;
|
||||||
@ -27,9 +24,5 @@ function testcase() {
|
|||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return obj.property === 12;
|
|
||||||
} finally {
|
assert.sameValue(obj.property, 12, 'obj.property');
|
||||||
delete Function.prototype.property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,13 +6,10 @@ es5id: 15.3.4.5.2-4-5
|
|||||||
description: >
|
description: >
|
||||||
[[Construct]] - length of parameters of 'target' is 0, length of
|
[[Construct]] - length of parameters of 'target' is 0, length of
|
||||||
'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'
|
'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var obj = { prop: "abc" };
|
var obj = { prop: "abc" };
|
||||||
|
|
||||||
try {
|
|
||||||
Object.prototype.verifyThis = "verifyThis";
|
Object.prototype.verifyThis = "verifyThis";
|
||||||
var func = function () {
|
var func = function () {
|
||||||
return new Boolean(arguments.length === 0 && Object.prototype.toString.call(this) === "[object Object]" &&
|
return new Boolean(arguments.length === 0 && Object.prototype.toString.call(this) === "[object Object]" &&
|
||||||
@ -23,9 +20,4 @@ function testcase() {
|
|||||||
|
|
||||||
var newInstance = new NewFunc();
|
var newInstance = new NewFunc();
|
||||||
|
|
||||||
return newInstance.valueOf();
|
assert(newInstance.valueOf(), 'newInstance.valueOf() !== true');
|
||||||
} finally {
|
|
||||||
delete Object.prototype.verifyThis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -8,17 +8,12 @@ description: >
|
|||||||
the Constructor Properties of the Global Object under strict mode
|
the Constructor Properties of the Global Object under strict mode
|
||||||
(Object)
|
(Object)
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var objBak = Object;
|
var objBak = Object;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Object = 12;
|
Object = 12;
|
||||||
return true;
|
|
||||||
} finally {
|
} finally {
|
||||||
Object = objBak;
|
Object = objBak;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -8,16 +8,11 @@ description: >
|
|||||||
the Constructor Properties of the Global Object under strict mode
|
the Constructor Properties of the Global Object under strict mode
|
||||||
(Number)
|
(Number)
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var numBak = Number;
|
var numBak = Number;
|
||||||
try {
|
try {
|
||||||
Number = 12;
|
Number = 12;
|
||||||
return true;
|
|
||||||
} finally {
|
} finally {
|
||||||
Number = numBak;
|
Number = numBak;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Arguments Object has index property '0' as its own property, it
|
Arguments Object has index property '0' as its own property, it
|
||||||
shoulde be writable, enumerable, configurable and does not invoke
|
shoulde be writable, enumerable, configurable and does not invoke
|
||||||
the setter defined on Object.prototype[0] (Step 11.b)
|
the setter defined on Object.prototype[0] (Step 11.b)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
|
||||||
var data = "data";
|
var data = "data";
|
||||||
var getFunc = function () {
|
var getFunc = function () {
|
||||||
return data;
|
return data;
|
||||||
@ -47,9 +44,8 @@ function testcase() {
|
|||||||
delete argObj[0];
|
delete argObj[0];
|
||||||
verifyConfigurable = argObj.hasOwnProperty("0");
|
verifyConfigurable = argObj.hasOwnProperty("0");
|
||||||
|
|
||||||
return verifyValue && verifyWritable && verifyEnumerable && !verifyConfigurable && data === "data";
|
assert(verifyValue, 'verifyValue !== true');
|
||||||
} finally {
|
assert(verifyWritable, 'verifyWritable !== true');
|
||||||
delete Object.prototype[0];
|
assert(verifyEnumerable, 'verifyEnumerable !== true');
|
||||||
}
|
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
|
||||||
}
|
assert.sameValue(data, "data", 'data');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
In non-strict mode, arguments object should have its own 'callee'
|
In non-strict mode, arguments object should have its own 'callee'
|
||||||
property defined (Step 13.a)
|
property defined (Step 13.a)
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
|
||||||
Object.defineProperty(Object.prototype, "callee", {
|
Object.defineProperty(Object.prototype, "callee", {
|
||||||
value: 1,
|
value: 1,
|
||||||
writable: false,
|
writable: false,
|
||||||
@ -38,9 +35,7 @@ function testcase() {
|
|||||||
delete argObj.callee;
|
delete argObj.callee;
|
||||||
verifyConfigurable = argObj.hasOwnProperty("callee");
|
verifyConfigurable = argObj.hasOwnProperty("callee");
|
||||||
|
|
||||||
return verifyValue && verifyWritable && !verifyEnumerable && !verifyConfigurable;
|
assert(verifyValue, 'verifyValue !== true');
|
||||||
} finally {
|
assert(verifyWritable, 'verifyWritable !== true');
|
||||||
delete Object.prototype.callee;
|
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
|
||||||
}
|
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 10.6-7-1
|
|||||||
description: >
|
description: >
|
||||||
Arguments Object has length as its own property and does not
|
Arguments Object has length as its own property and does not
|
||||||
invoke the setter defined on Object.prototype.length (Step 7)
|
invoke the setter defined on Object.prototype.length (Step 7)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
|
||||||
var data = "data";
|
var data = "data";
|
||||||
var getFunc = function () {
|
var getFunc = function () {
|
||||||
return 12;
|
return 12;
|
||||||
@ -45,9 +42,8 @@ function testcase() {
|
|||||||
delete argObj.length;
|
delete argObj.length;
|
||||||
verifyConfigurable = argObj.hasOwnProperty("length");
|
verifyConfigurable = argObj.hasOwnProperty("length");
|
||||||
|
|
||||||
return verifyValue && verifyWritable && !verifyEnumerable && !verifyConfigurable && data === "data";
|
assert(verifyValue, 'verifyValue !== true');
|
||||||
} finally {
|
assert(verifyWritable, 'verifyWritable !== true');
|
||||||
delete Object.prototype.length;
|
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
|
||||||
}
|
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
|
||||||
}
|
assert.sameValue(data, "data", 'data');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -13,11 +13,8 @@ description: >
|
|||||||
Initialize array using ElementList (Elisionopt
|
Initialize array using ElementList (Elisionopt
|
||||||
AssignmentExpression) when index property (read-only) exists in
|
AssignmentExpression) when index property (read-only) exists in
|
||||||
Array.prototype (step 5)
|
Array.prototype (step 5)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
|
||||||
Object.defineProperty(Array.prototype, "0", {
|
Object.defineProperty(Array.prototype, "0", {
|
||||||
value: 100,
|
value: 100,
|
||||||
writable: false,
|
writable: false,
|
||||||
@ -25,9 +22,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
var arr = [101];
|
var arr = [101];
|
||||||
|
|
||||||
return arr.hasOwnProperty("0") && arr[0] === 101;
|
assert(arr.hasOwnProperty("0"), 'arr.hasOwnProperty("0") !== true');
|
||||||
} finally {
|
assert.sameValue(arr[0], 101, 'arr[0]');
|
||||||
delete Array.prototype[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -13,11 +13,8 @@ description: >
|
|||||||
Initialize array using ElementList (ElementList , Elisionopt
|
Initialize array using ElementList (ElementList , Elisionopt
|
||||||
AssignmentExpression) when index property (read-only) exists in
|
AssignmentExpression) when index property (read-only) exists in
|
||||||
Array.prototype (step 6)
|
Array.prototype (step 6)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
|
||||||
Object.defineProperty(Array.prototype, "1", {
|
Object.defineProperty(Array.prototype, "1", {
|
||||||
value: 100,
|
value: 100,
|
||||||
writable: false,
|
writable: false,
|
||||||
@ -25,9 +22,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
var arr = [101, 12];
|
var arr = [101, 12];
|
||||||
|
|
||||||
return arr.hasOwnProperty("1") && arr[1] === 12;
|
assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true');
|
||||||
} finally {
|
assert.sameValue(arr[1], 12, 'arr[1]');
|
||||||
delete Array.prototype[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -9,25 +9,9 @@ es5id: 11.4.1-4.a-10
|
|||||||
description: >
|
description: >
|
||||||
delete operator returns true for property (stringify) defined on
|
delete operator returns true for property (stringify) defined on
|
||||||
built-in object (JSON)
|
built-in object (JSON)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
var d = delete JSON.stringify;
|
||||||
try {
|
|
||||||
var o = JSON.stringify;
|
assert.sameValue(d, true, 'd');
|
||||||
var desc;
|
assert.sameValue(JSON.stringify, undefined, 'JSON.stringify');
|
||||||
try {
|
|
||||||
desc = Object.getOwnPropertyDescriptor(JSON, 'stringify')
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
};
|
|
||||||
var d = delete JSON.stringify;
|
|
||||||
if (d === true && JSON.stringify === undefined) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (desc) Object.defineProperty(JSON, 'stringify', desc)
|
|
||||||
else JSON.stringify = o /* this branch messes up the attributes */;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -8,18 +8,8 @@ info: >
|
|||||||
es5id: 11.4.1-4.a-8
|
es5id: 11.4.1-4.a-8
|
||||||
description: delete operator returns true for built-in objects (JSON)
|
description: delete operator returns true for built-in objects (JSON)
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
var d = delete JSON;
|
||||||
try {
|
|
||||||
var o = JSON;
|
assert.sameValue(d, true, 'd');
|
||||||
var d = delete JSON;
|
|
||||||
if (d === true) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
JSON = o;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,19 +7,8 @@ description: >
|
|||||||
Strict Mode - SyntaxError is thrown when deleting a built-in
|
Strict Mode - SyntaxError is thrown when deleting a built-in
|
||||||
(Error)
|
(Error)
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
assert.throws(SyntaxError, function() {
|
||||||
var errorBackup = Error;
|
|
||||||
try {
|
|
||||||
eval("delete Error;");
|
eval("delete Error;");
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return e instanceof SyntaxError;
|
|
||||||
} finally {
|
|
||||||
Error = errorBackup;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -12,11 +12,8 @@ description: >
|
|||||||
Object initialization using PropertyNameAndValueList
|
Object initialization using PropertyNameAndValueList
|
||||||
(PropertyAssignment) when property (read-only) exists in
|
(PropertyAssignment) when property (read-only) exists in
|
||||||
Object.prototype (step 3)
|
Object.prototype (step 3)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
|
||||||
Object.defineProperty(Object.prototype, "prop", {
|
Object.defineProperty(Object.prototype, "prop", {
|
||||||
value: 100,
|
value: 100,
|
||||||
writable: false,
|
writable: false,
|
||||||
@ -24,9 +21,5 @@ function testcase() {
|
|||||||
});
|
});
|
||||||
var obj = { prop: 12 };
|
var obj = { prop: 12 };
|
||||||
|
|
||||||
return obj.hasOwnProperty("prop") && obj.prop === 12;
|
assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true');
|
||||||
} finally {
|
assert.sameValue(obj.prop, 12, 'obj.prop');
|
||||||
delete Object.prototype.prop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -12,11 +12,8 @@ description: >
|
|||||||
Object initialization using PropertyNameAndValueList
|
Object initialization using PropertyNameAndValueList
|
||||||
(PropertyNameAndValueList , PropertyAssignment) when property
|
(PropertyNameAndValueList , PropertyAssignment) when property
|
||||||
(read-only) exists in Object.prototype (Step 5)
|
(read-only) exists in Object.prototype (Step 5)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
|
||||||
Object.defineProperty(Object.prototype, "prop2", {
|
Object.defineProperty(Object.prototype, "prop2", {
|
||||||
value: 100,
|
value: 100,
|
||||||
writable: false,
|
writable: false,
|
||||||
@ -25,9 +22,4 @@ function testcase() {
|
|||||||
|
|
||||||
var obj = { prop1: 101, prop2: 12 };
|
var obj = { prop1: 101, prop2: 12 };
|
||||||
|
|
||||||
return obj.hasOwnProperty("prop2");
|
assert(obj.hasOwnProperty("prop2"), 'obj.hasOwnProperty("prop2") !== true');
|
||||||
} finally {
|
|
||||||
delete Object.prototype.prop2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,12 +7,10 @@ description: >
|
|||||||
Function Object has 'constructor' as its own property, it is not
|
Function Object has 'constructor' as its own property, it is not
|
||||||
enumerable and does not invoke the setter defined on
|
enumerable and does not invoke the setter defined on
|
||||||
Function.prototype.constructor (Step 17)
|
Function.prototype.constructor (Step 17)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(Object.prototype, "constructor");
|
var desc = Object.getOwnPropertyDescriptor(Object.prototype, "constructor");
|
||||||
try {
|
|
||||||
var getFunc = function () {
|
var getFunc = function () {
|
||||||
return 100;
|
return 100;
|
||||||
};
|
};
|
||||||
@ -48,9 +46,8 @@ function testcase() {
|
|||||||
delete fun.prototype.constructor;
|
delete fun.prototype.constructor;
|
||||||
verifyConfigurable = fun.hasOwnProperty("constructor");
|
verifyConfigurable = fun.hasOwnProperty("constructor");
|
||||||
|
|
||||||
return verifyValue && verifyWritable && !verifyEnumerable && !verifyConfigurable && data === "data";
|
assert(verifyValue, 'verifyValue !== true');
|
||||||
} finally {
|
assert(verifyWritable, 'verifyWritable !== true');
|
||||||
Object.defineProperty(Object.prototype, "constructor", desc);
|
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
|
||||||
}
|
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
|
||||||
}
|
assert.sameValue(data, "data", 'data');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,17 +4,16 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 12.14-13
|
es5id: 12.14-13
|
||||||
description: catch introduces scope - updates are based on scope
|
description: catch introduces scope - updates are based on scope
|
||||||
includes: [runTestCase.js]
|
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var res1 = false;
|
var res1 = false;
|
||||||
var res2 = false;
|
var res2 = false;
|
||||||
var res3 = false;
|
var res3 = false;
|
||||||
|
|
||||||
|
(function() {
|
||||||
var x_12_14_13 = 'local';
|
var x_12_14_13 = 'local';
|
||||||
try {
|
|
||||||
function foo() {
|
function foo() {
|
||||||
this.x_12_14_13 = 'instance';
|
this.x_12_14_13 = 'instance';
|
||||||
}
|
}
|
||||||
@ -28,14 +27,8 @@ function testcase() {
|
|||||||
res2 = (x_12_14_13 === 'local');
|
res2 = (x_12_14_13 === 'local');
|
||||||
}
|
}
|
||||||
res3 = (x_12_14_13 === 'local');
|
res3 = (x_12_14_13 === 'local');
|
||||||
|
})();
|
||||||
|
|
||||||
if (res1 === true &&
|
assert(res1, 'res1 !== true');
|
||||||
res2 === true &&
|
assert(res2, 'res2 !== true');
|
||||||
res3 === true) {
|
assert(res3, 'res3 !== true');
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
delete this.x_12_14_13;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,24 +7,21 @@ description: >
|
|||||||
Exception object is a function, when an exception parameter is
|
Exception object is a function, when an exception parameter is
|
||||||
called as a function in catch block, global object is passed as
|
called as a function in catch block, global object is passed as
|
||||||
the this value
|
the this value
|
||||||
includes:
|
includes: [fnGlobalObject.js]
|
||||||
- runTestCase.js
|
|
||||||
- fnGlobalObject.js
|
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
var result;
|
||||||
|
|
||||||
|
(function() {
|
||||||
try {
|
try {
|
||||||
throw function () {
|
throw function () {
|
||||||
this._12_14_14_foo = "test";
|
this._12_14_14_foo = "test";
|
||||||
};
|
};
|
||||||
return false;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
e();
|
e();
|
||||||
return fnGlobalObject()._12_14_14_foo === "test";
|
result = fnGlobalObject()._12_14_14_foo;
|
||||||
}
|
}
|
||||||
finally {
|
})();
|
||||||
delete fnGlobalObject()._12_14_14_foo;
|
|
||||||
}
|
assert.sameValue(result, "test", 'result');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,26 +7,23 @@ description: >
|
|||||||
Exception object is a function which is a property of an object,
|
Exception object is a function which is a property of an object,
|
||||||
when an exception parameter is called as a function in catch
|
when an exception parameter is called as a function in catch
|
||||||
block, global object is passed as the this value
|
block, global object is passed as the this value
|
||||||
includes:
|
includes: [fnGlobalObject.js]
|
||||||
- runTestCase.js
|
|
||||||
- fnGlobalObject.js
|
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
var result;
|
||||||
|
|
||||||
|
(function() {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj.test = function () {
|
obj.test = function () {
|
||||||
this._12_14_15_foo = "test";
|
this._12_14_15_foo = "test";
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
throw obj.test;
|
throw obj.test;
|
||||||
return false;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
e();
|
e();
|
||||||
return fnGlobalObject()._12_14_15_foo === "test";
|
result = fnGlobalObject()._12_14_15_foo;
|
||||||
}
|
}
|
||||||
finally {
|
})();
|
||||||
delete fnGlobalObject()._12_14_15_foo;
|
|
||||||
}
|
assert.sameValue(result, "test", 'result');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,18 +7,17 @@ description: >
|
|||||||
Exception object is a function which update in catch block, when
|
Exception object is a function which update in catch block, when
|
||||||
an exception parameter is called as a function in catch block,
|
an exception parameter is called as a function in catch block,
|
||||||
global object is passed as the this value
|
global object is passed as the this value
|
||||||
includes:
|
includes: [fnGlobalObject.js]
|
||||||
- runTestCase.js
|
|
||||||
- fnGlobalObject.js
|
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
var result;
|
||||||
|
|
||||||
|
(function() {
|
||||||
try {
|
try {
|
||||||
throw function () {
|
throw function () {
|
||||||
this._12_14_16_foo = "test";
|
this._12_14_16_foo = "test";
|
||||||
};
|
};
|
||||||
return false;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj.test = function () {
|
obj.test = function () {
|
||||||
@ -26,11 +25,8 @@ function testcase() {
|
|||||||
};
|
};
|
||||||
e = obj.test;
|
e = obj.test;
|
||||||
e();
|
e();
|
||||||
return fnGlobalObject()._12_14_16_foo === "test1";
|
result = fnGlobalObject()._12_14_16_foo;
|
||||||
}
|
|
||||||
finally {
|
|
||||||
delete fnGlobalObject()._12_14_16_foo;
|
|
||||||
}
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
}
|
assert.sameValue(result, "test1", 'result');
|
||||||
runTestCase(testcase);
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user