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