Replace runTestCase with assert, try-finally, [test/built-ins/Object]

This commit is contained in:
André Bargull 2015-08-13 17:41:47 +02:00
parent 39b5b7272c
commit 6b48d9f1b2
215 changed files with 599 additions and 2153 deletions

View File

@ -6,11 +6,8 @@ es5id: 15.2.3.5-4-10
description: > description: >
Object.create - argument 'Properties' is the Math object (15.2.3.7 Object.create - argument 'Properties' is the Math object (15.2.3.7
step 2) step 2)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
Object.defineProperty(Math, "prop", { Object.defineProperty(Math, "prop", {
get: function () { get: function () {
@ -21,11 +18,7 @@ function testcase() {
configurable: true configurable: true
}); });
try {
var newObj = Object.create({}, Math); var newObj = Object.create({}, Math);
return result && newObj.hasOwnProperty("prop");
} finally { assert(result, 'result !== true');
delete Math.prop; assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true');
}
}
runTestCase(testcase);

View File

@ -7,12 +7,8 @@ description: >
Object.create - one property in 'Properties' is the Math object Object.create - one property in 'Properties' is the Math object
that uses Object's [[Get]] method to access the 'configurable' that uses Object's [[Get]] method to access the 'configurable'
property (8.10.5 step 4.a) property (8.10.5 step 4.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Math.configurable = true; Math.configurable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -23,9 +19,5 @@ function testcase() {
delete newObj.prop; delete newObj.prop;
var result2 = newObj.hasOwnProperty("prop"); var result2 = newObj.hasOwnProperty("prop");
return result1 === true && result2 === false; assert.sameValue(result1, true, 'result1');
} finally { assert.sameValue(result2, false, 'result2');
delete Math.configurable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,8 @@ description: >
Object.create - one property in 'Properties' is the JSON object Object.create - one property in 'Properties' is the JSON object
that uses Object's [[Get]] method to access the 'configurable' that uses Object's [[Get]] method to access the 'configurable'
property (8.10.5 step 4.a) property (8.10.5 step 4.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
JSON.configurable = true; JSON.configurable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -23,9 +19,5 @@ function testcase() {
delete newObj.prop; delete newObj.prop;
var result2 = newObj.hasOwnProperty("prop"); var result2 = newObj.hasOwnProperty("prop");
return result1 === true && result2 === false; assert.sameValue(result1, true, 'result1');
} finally { assert.sameValue(result2, false, 'result2');
delete JSON.configurable;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,9 @@ description: >
Object.create - one property in 'Properties' is the global object Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'configurable' that uses Object's [[Get]] method to access the 'configurable'
property (8.10.5 step 4.a) property (8.10.5 step 4.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
try {
fnGlobalObject().configurable = true; fnGlobalObject().configurable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -25,9 +20,5 @@ function testcase() {
delete newObj.prop; delete newObj.prop;
var result2 = newObj.hasOwnProperty("prop"); var result2 = newObj.hasOwnProperty("prop");
return result1 === true && result2 === false; assert.sameValue(result1, true, 'result1');
} finally { assert.sameValue(result2, false, 'result2');
delete fnGlobalObject().configurable;
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.2.3.5-4-13
description: > description: >
Object.create - argument 'Properties' is the JSON object (15.2.3.7 Object.create - argument 'Properties' is the JSON object (15.2.3.7
step 2) step 2)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var result = false; var result = false;
Object.defineProperty(JSON, "prop", { Object.defineProperty(JSON, "prop", {
@ -22,11 +19,7 @@ function testcase() {
configurable: true configurable: true
}); });
try {
var newObj = Object.create({}, JSON); var newObj = Object.create({}, JSON);
return result && newObj.hasOwnProperty("prop");
} finally { assert(result, 'result !== true');
delete JSON.prop; assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true');
}
}
runTestCase(testcase);

View File

@ -7,21 +7,12 @@ description: >
Object.create - one property in 'Properties' is the Math object Object.create - one property in 'Properties' is the Math object
that uses Object's [[Get]] method to access the 'value' property that uses Object's [[Get]] method to access the 'value' property
(8.10.5 step 5.a) (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Math.value = "MathValue"; Math.value = "MathValue";
var newObj = Object.create({}, { var newObj = Object.create({}, {
prop: Math prop: Math
}); });
return newObj.prop === "MathValue"; assert.sameValue(newObj.prop, "MathValue", 'newObj.prop');
} finally {
delete Math.value;
}
}
runTestCase(testcase);

View File

@ -7,21 +7,12 @@ description: >
Object.create - one property in 'Properties' is the JSON object Object.create - one property in 'Properties' is the JSON object
that uses Object's [[Get]] method to access the 'value' property that uses Object's [[Get]] method to access the 'value' property
(8.10.5 step 5.a) (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
JSON.value = "JSONValue"; JSON.value = "JSONValue";
var newObj = Object.create({}, { var newObj = Object.create({}, {
prop: JSON prop: JSON
}); });
return newObj.prop === "JSONValue"; assert.sameValue(newObj.prop, "JSONValue", 'newObj.prop');
} finally {
delete JSON.value;
}
}
runTestCase(testcase);

View File

@ -7,23 +7,13 @@ description: >
Object.create - one property in 'Properties' is the global object Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'value' property that uses Object's [[Get]] method to access the 'value' property
(8.10.5 step 5.a) (8.10.5 step 5.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
try {
fnGlobalObject().value = "GlobalValue"; fnGlobalObject().value = "GlobalValue";
var newObj = Object.create({}, { var newObj = Object.create({}, {
prop: fnGlobalObject() prop: fnGlobalObject()
}); });
return newObj.prop === "GlobalValue"; assert.sameValue(newObj.prop, "GlobalValue", 'newObj.prop');
} finally {
delete fnGlobalObject().value;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,8 @@ description: >
Object.create - one property in 'Properties' is the Math object Object.create - one property in 'Properties' is the Math object
that uses Object's [[Get]] method to access the 'writable' that uses Object's [[Get]] method to access the 'writable'
property (8.10.5 step 6.a) property (8.10.5 step 6.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Math.writable = true; Math.writable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -25,9 +21,5 @@ function testcase() {
var afterWrite = (newObj.prop === "isWritable"); var afterWrite = (newObj.prop === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Math.writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,8 @@ description: >
Object.create - one property in 'Properties' is the JSON object Object.create - one property in 'Properties' is the JSON object
that uses Object's [[Get]] method to access the 'writable' that uses Object's [[Get]] method to access the 'writable'
property (8.10.5 step 6.a) property (8.10.5 step 6.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
JSON.writable = true; JSON.writable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -25,9 +21,5 @@ function testcase() {
var afterWrite = (newObj.prop === "isWritable"); var afterWrite = (newObj.prop === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete JSON.writable;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,9 @@ description: >
Object.create - one property in 'Properties' is the global object Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'writable' that uses Object's [[Get]] method to access the 'writable'
property (8.10.5 step 6.a) property (8.10.5 step 6.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
try {
fnGlobalObject().writable = true; fnGlobalObject().writable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -27,9 +22,5 @@ function testcase() {
var afterWrite = (newObj.prop === "isWritable"); var afterWrite = (newObj.prop === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete fnGlobalObject().writable;
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Object.create - one property in 'Properties' is the Math object Object.create - one property in 'Properties' is the Math object
that uses Object's [[Get]] method to access the 'get' property that uses Object's [[Get]] method to access the 'get' property
(8.10.5 step 7.a) (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Math.get = function () { Math.get = function () {
return "VerifyMathObject"; return "VerifyMathObject";
}; };
@ -20,9 +17,4 @@ function testcase() {
prop: Math prop: Math
}); });
return newObj.prop === "VerifyMathObject"; assert.sameValue(newObj.prop, "VerifyMathObject", 'newObj.prop');
} finally {
delete Math.get;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.create - one property in 'Properties' is the JSON object Object.create - one property in 'Properties' is the JSON object
that uses Object's [[Get]] method to access the 'get' property that uses Object's [[Get]] method to access the 'get' property
(8.10.5 step 7.a) (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
JSON.get = function () { JSON.get = function () {
return "VerifyJSONObject"; return "VerifyJSONObject";
}; };
try {
var newObj = Object.create({}, { var newObj = Object.create({}, {
prop: JSON prop: JSON
}); });
return newObj.prop === "VerifyJSONObject"; assert.sameValue(newObj.prop, "VerifyJSONObject", 'newObj.prop');
} finally {
delete JSON.get;
}
}
runTestCase(testcase);

View File

@ -7,24 +7,15 @@ description: >
Object.create - one property in 'Properties' is the global object Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'get' property that uses Object's [[Get]] method to access the 'get' property
(8.10.5 step 7.a) (8.10.5 step 7.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
fnGlobalObject().get = function () { fnGlobalObject().get = function () {
return "VerifyGlobalObject"; return "VerifyGlobalObject";
}; };
try {
var newObj = Object.create({}, { var newObj = Object.create({}, {
prop: fnGlobalObject() prop: fnGlobalObject()
}); });
return newObj.prop === "VerifyGlobalObject"; assert.sameValue(newObj.prop, "VerifyGlobalObject", 'newObj.prop');
} finally {
delete fnGlobalObject().get;
}
}
runTestCase(testcase);

View File

@ -7,13 +7,10 @@ description: >
Object.create - one property in 'Properties' is the Math object Object.create - one property in 'Properties' is the Math object
that uses Object's [[Get]] method to access the 'set' property that uses Object's [[Get]] method to access the 'set' property
(8.10.5 step 8.a) (8.10.5 step 8.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var data = "data"; var data = "data";
try {
Math.set = function (value) { Math.set = function (value) {
data = value; data = value;
}; };
@ -26,9 +23,5 @@ function testcase() {
newObj.prop = "overrideData"; newObj.prop = "overrideData";
return hasProperty && data === "overrideData"; assert(hasProperty, 'hasProperty !== true');
} finally { assert.sameValue(data, "overrideData", 'data');
delete Math.set;
}
}
runTestCase(testcase);

View File

@ -7,13 +7,10 @@ description: >
Object.create - one property in 'Properties' is the JSON object Object.create - one property in 'Properties' is the JSON object
that uses Object's [[Get]] method to access the 'set' property that uses Object's [[Get]] method to access the 'set' property
(8.10.5 step 8.a) (8.10.5 step 8.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var data = "data"; var data = "data";
try {
JSON.set = function (value) { JSON.set = function (value) {
data = value; data = value;
}; };
@ -26,9 +23,5 @@ function testcase() {
newObj.prop = "overrideData"; newObj.prop = "overrideData";
return hasProperty && data === "overrideData"; assert(hasProperty, 'hasProperty !== true');
} finally { assert.sameValue(data, "overrideData", 'data');
delete JSON.set;
}
}
runTestCase(testcase);

View File

@ -7,15 +7,11 @@ description: >
Object.create - one property in 'Properties' is the global object Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'set' property that uses Object's [[Get]] method to access the 'set' property
(8.10.5 step 8.a) (8.10.5 step 8.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var data = "data"; var data = "data";
try {
fnGlobalObject().set = function (value) { fnGlobalObject().set = function (value) {
data = value; data = value;
}; };
@ -28,9 +24,5 @@ function testcase() {
newObj.prop = "overrideData"; newObj.prop = "overrideData";
return hasProperty && data === "overrideData"; assert(hasProperty, 'hasProperty !== true');
} finally { assert.sameValue(data, "overrideData", 'data');
delete fnGlobalObject().set;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Object.create - 'Properties' is the Math object that uses Object's Object.create - 'Properties' is the Math object that uses Object's
[[Get]] method to access own enumerable property (15.2.3.7 step [[Get]] method to access own enumerable property (15.2.3.7 step
5.a) 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Math.prop = { Math.prop = {
value: 12, value: 12,
enumerable: true enumerable: true
}; };
var newObj = Object.create({}, Math); var newObj = Object.create({}, Math);
return newObj.hasOwnProperty("prop");
} finally { assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true');
delete Math.prop;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Object.create - 'Properties' is the JSON object that uses Object's Object.create - 'Properties' is the JSON object that uses Object's
[[Get]] method to access own enumerable property (15.2.3.7 step [[Get]] method to access own enumerable property (15.2.3.7 step
5.a) 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
JSON.prop = { JSON.prop = {
value: 12, value: 12,
enumerable: true enumerable: true
}; };
var newObj = Object.create({}, JSON); var newObj = Object.create({}, JSON);
return newObj.hasOwnProperty("prop");
} finally { assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true');
delete JSON.prop;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,10 @@ description: >
Object.create - one property in 'Properties' is the Math object Object.create - one property in 'Properties' is the Math object
that uses Object's [[Get]] method to access the 'enumerable' that uses Object's [[Get]] method to access the 'enumerable'
property (8.10.5 step 3.a) property (8.10.5 step 3.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
try {
Math.enumerable = true; Math.enumerable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -25,9 +21,5 @@ function testcase() {
accessed = true; accessed = true;
} }
} }
return accessed;
} finally { assert(accessed, 'accessed !== true');
delete Math.enumerable;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,10 @@ description: >
Object.create - one property in 'Properties' is the JSON object Object.create - one property in 'Properties' is the JSON object
that uses Object's [[Get]] method to access the 'enumerable' that uses Object's [[Get]] method to access the 'enumerable'
property (8.10.5 step 3.a) property (8.10.5 step 3.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
try {
JSON.enumerable = true; JSON.enumerable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -25,9 +21,5 @@ function testcase() {
accessed = true; accessed = true;
} }
} }
return accessed;
} finally { assert(accessed, 'accessed !== true');
delete JSON.enumerable;
}
}
runTestCase(testcase);

View File

@ -7,16 +7,11 @@ description: >
Object.create - one property in 'Properties' is the global object Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'enumerable' that uses Object's [[Get]] method to access the 'enumerable'
property (8.10.5 step 3.a) property (8.10.5 step 3.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
try {
fnGlobalObject().enumerable = true; fnGlobalObject().enumerable = true;
var newObj = Object.create({}, { var newObj = Object.create({}, {
@ -27,9 +22,5 @@ function testcase() {
accessed = true; accessed = true;
} }
} }
return accessed;
} finally { assert(accessed, 'accessed !== true');
delete fnGlobalObject().enumerable;
}
}
runTestCase(testcase);

View File

@ -4,15 +4,11 @@
/*--- /*---
es5id: 15.2.3.7-2-11 es5id: 15.2.3.7-2-11
description: Object.defineProperties - argument 'Properties' is the Math object description: Object.defineProperties - argument 'Properties' is the Math object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var result = false; var result = false;
try {
Object.defineProperty(Math, "prop", { Object.defineProperty(Math, "prop", {
get: function () { get: function () {
result = (this === Math); result = (this === Math);
@ -23,9 +19,5 @@ function testcase() {
}); });
Object.defineProperties(obj, Math); Object.defineProperties(obj, Math);
return result;
} finally { assert(result, 'result !== true');
delete Math.prop;
}
}
runTestCase(testcase);

View File

@ -4,15 +4,11 @@
/*--- /*---
es5id: 15.2.3.7-2-14 es5id: 15.2.3.7-2-14
description: Object.defineProperties - argument 'Properties' is the JSON object description: Object.defineProperties - argument 'Properties' is the JSON object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var result = false; var result = false;
try {
Object.defineProperty(JSON, "prop", { Object.defineProperty(JSON, "prop", {
get: function () { get: function () {
result = (this === JSON); result = (this === JSON);
@ -23,9 +19,5 @@ function testcase() {
}); });
Object.defineProperties(obj, JSON); Object.defineProperties(obj, JSON);
return result;
} finally { assert(result, 'result !== true');
delete JSON.prop;
}
}
runTestCase(testcase);

View File

@ -6,13 +6,9 @@ es5id: 15.2.3.7-2-18
description: > description: >
Object.defineProperties - argument 'Properties' is the global Object.defineProperties - argument 'Properties' is the global
object object
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var result = false; var result = false;
@ -27,11 +23,11 @@ function testcase() {
}); });
Object.defineProperties(obj, fnGlobalObject()); Object.defineProperties(obj, fnGlobalObject());
return result;
} catch (e) { } catch (e) {
return (e instanceof TypeError); if (!(e instanceof TypeError)) throw e;
result = true;
} finally { } finally {
delete fnGlobalObject().prop; delete fnGlobalObject().prop;
} }
}
runTestCase(testcase); assert(result, 'result !== true');

View File

@ -6,22 +6,14 @@ es5id: 15.2.3.7-5-a-12
description: > description: >
Object.defineProperties - 'Properties' is the Math object which Object.defineProperties - 'Properties' is the Math object which
implements its own [[Get]] method to get enumerable own property implements its own [[Get]] method to get enumerable own property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Math.prop = { Math.prop = {
value: 12 value: 12
}; };
Object.defineProperties(obj, Math); Object.defineProperties(obj, Math);
return obj.hasOwnProperty("prop") && obj.prop === 12; assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true');
} finally { assert.sameValue(obj.prop, 12, 'obj.prop');
delete Math.prop;
}
}
runTestCase(testcase);

View File

@ -6,21 +6,14 @@ es5id: 15.2.3.7-5-a-15
description: > description: >
Object.defineProperties - 'Properties' is the JSON object which Object.defineProperties - 'Properties' is the JSON object which
implements its own [[Get]] method to get enumerable own property implements its own [[Get]] method to get enumerable own property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
JSON.prop = { JSON.prop = {
value: 15 value: 15
}; };
Object.defineProperties(obj, JSON); Object.defineProperties(obj, JSON);
return obj.hasOwnProperty("prop") && obj.prop === 15; assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true');
} finally { assert.sameValue(obj.prop, 15, 'obj.prop');
delete JSON.prop;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'descObj' is the Math object which Object.defineProperties - 'descObj' is the Math object which
implements its own [[Get]] method to get 'value' property (8.10.5 implements its own [[Get]] method to get 'value' property (8.10.5
step 5.a) step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Math.value = "Math"; Math.value = "Math";
Object.defineProperties(obj, { Object.defineProperties(obj, {
property: Math property: Math
}); });
return obj.property === "Math"; assert.sameValue(obj.property, "Math", 'obj.property');
} finally {
delete Math.value;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'descObj' is the JSON object which Object.defineProperties - 'descObj' is the JSON object which
implements its own [[Get]] method to get 'value' property (8.10.5 implements its own [[Get]] method to get 'value' property (8.10.5
step 5.a) step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
JSON.value = "JSON"; JSON.value = "JSON";
Object.defineProperties(obj, { Object.defineProperties(obj, {
property: JSON property: JSON
}); });
return obj.property === "JSON"; assert.sameValue(obj.property, "JSON", 'obj.property');
} finally {
delete JSON.value;
}
}
runTestCase(testcase);

View File

@ -7,24 +7,15 @@ description: >
Object.defineProperties - 'descObj' is the global object which Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'value' property (8.10.5 implements its own [[Get]] method to get 'value' property (8.10.5
step 5.a) step 5.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
fnGlobalObject().value = "global"; fnGlobalObject().value = "global";
Object.defineProperties(obj, { Object.defineProperties(obj, {
property: fnGlobalObject() property: fnGlobalObject()
}); });
return obj.property === "global"; assert.sameValue(obj.property, "global", 'obj.property');
} finally {
delete fnGlobalObject().value;
}
}
runTestCase(testcase);

View File

@ -13,7 +13,6 @@ includes: [propertyHelper.js]
var obj = {}; var obj = {};
try {
Math.writable = false; Math.writable = false;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -22,7 +21,3 @@ try {
assert(obj.hasOwnProperty("property")); assert(obj.hasOwnProperty("property"));
verifyNotWritable(obj, "property"); verifyNotWritable(obj, "property");
} finally {
delete Math.writable;
}

View File

@ -12,7 +12,6 @@ includes: [propertyHelper.js]
var obj = {}; var obj = {};
try {
JSON.writable = false; JSON.writable = false;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -21,8 +20,3 @@ try {
assert(obj.hasOwnProperty("property")); assert(obj.hasOwnProperty("property"));
verifyNotWritable(obj, "property"); verifyNotWritable(obj, "property");
} finally {
delete JSON.writable;
}

View File

@ -15,7 +15,6 @@ includes:
var obj = {}; var obj = {};
try {
fnGlobalObject().writable = false; fnGlobalObject().writable = false;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -24,9 +23,3 @@ try {
assert(obj.hasOwnProperty("property")); assert(obj.hasOwnProperty("property"));
verifyNotWritable(obj, "property"); verifyNotWritable(obj, "property");
} finally {
delete fnGlobalObject().writable;
}

View File

@ -7,14 +7,10 @@ description: >
Object.defineProperties - 'descObj' is the Math object which Object.defineProperties - 'descObj' is the Math object which
implements its own [[Get]] method to get 'get' property (8.10.5 implements its own [[Get]] method to get 'get' property (8.10.5
step 7.a) step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Math.get = function () { Math.get = function () {
return "Math"; return "Math";
}; };
@ -23,9 +19,4 @@ function testcase() {
property: Math property: Math
}); });
return obj.property === "Math"; assert.sameValue(obj.property, "Math", 'obj.property');
} finally {
delete Math.get;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,10 @@ description: >
Object.defineProperties - 'descObj' is the JSON object which Object.defineProperties - 'descObj' is the JSON object which
implements its own [[Get]] method to get 'get' property (8.10.5 implements its own [[Get]] method to get 'get' property (8.10.5
step 7.a) step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
JSON.get = function () { JSON.get = function () {
return "JSON"; return "JSON";
}; };
@ -23,9 +19,4 @@ function testcase() {
property: JSON property: JSON
}); });
return obj.property === "JSON"; assert.sameValue(obj.property, "JSON", 'obj.property');
} finally {
delete JSON.get;
}
}
runTestCase(testcase);

View File

@ -7,16 +7,11 @@ description: >
Object.defineProperties - 'descObj' is the global object which Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'get' property (8.10.5 implements its own [[Get]] method to get 'get' property (8.10.5
step 7.a) step 7.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
fnGlobalObject().get = function () { fnGlobalObject().get = function () {
return "global"; return "global";
}; };
@ -25,9 +20,4 @@ function testcase() {
property: fnGlobalObject() property: fnGlobalObject()
}); });
return obj.property === "global"; assert.sameValue(obj.property, "global", 'obj.property');
} finally {
delete fnGlobalObject().get;
}
}
runTestCase(testcase);

View File

@ -7,15 +7,11 @@ description: >
Object.defineProperties - 'descObj' is the Math object which Object.defineProperties - 'descObj' is the Math object which
implements its own [[Get]] method to get 'enumerable' property implements its own [[Get]] method to get 'enumerable' property
(8.10.5 step 3.a) (8.10.5 step 3.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var accessed = false; var accessed = false;
try {
Math.enumerable = true; Math.enumerable = true;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -26,9 +22,5 @@ function testcase() {
accessed = true; accessed = true;
} }
} }
return accessed;
} finally { assert(accessed, 'accessed !== true');
delete Math.enumerable;
}
}
runTestCase(testcase);

View File

@ -7,16 +7,13 @@ description: >
Object.defineProperties - 'descObj' is the Math object which Object.defineProperties - 'descObj' is the Math object which
implements its own [[Get]] method to get 'set' property (8.10.5 implements its own [[Get]] method to get 'set' property (8.10.5
step 8.a) step 8.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var data = "data"; var data = "data";
var setFun = function (value) { var setFun = function (value) {
data = value; data = value;
}; };
try {
Math.prop = { Math.prop = {
set: setFun set: setFun
}; };
@ -24,9 +21,6 @@ function testcase() {
var obj = {}; var obj = {};
Object.defineProperties(obj, Math); Object.defineProperties(obj, Math);
obj.prop = "mathData"; obj.prop = "mathData";
return obj.hasOwnProperty("prop") && data === "mathData";
} finally { assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true');
delete Math.prop; assert.sameValue(data, "mathData", 'data');
}
}
runTestCase(testcase);

View File

@ -7,16 +7,13 @@ description: >
Object.defineProperties - 'descObj' is the JSON object which Object.defineProperties - 'descObj' is the JSON object which
implements its own [[Get]] method to get 'set' property (8.10.5 implements its own [[Get]] method to get 'set' property (8.10.5
step 8.a) step 8.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var data = "data"; var data = "data";
var setFun = function (value) { var setFun = function (value) {
data = value; data = value;
}; };
try {
JSON.prop = { JSON.prop = {
set: setFun set: setFun
}; };
@ -24,9 +21,6 @@ function testcase() {
var obj = {}; var obj = {};
Object.defineProperties(obj, JSON); Object.defineProperties(obj, JSON);
obj.prop = "JSONData"; obj.prop = "JSONData";
return obj.hasOwnProperty("prop") && data === "JSONData";
} finally { assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true');
delete JSON.prop; assert.sameValue(data, "JSONData", 'data');
}
}
runTestCase(testcase);

View File

@ -7,15 +7,11 @@ description: >
Object.defineProperties - 'descObj' is the JSON object which Object.defineProperties - 'descObj' is the JSON object which
implements its own [[Get]] method to get 'enumerable' property implements its own [[Get]] method to get 'enumerable' property
(8.10.5 step 3.a) (8.10.5 step 3.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var accessed = false; var accessed = false;
try {
JSON.enumerable = true; JSON.enumerable = true;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -26,9 +22,5 @@ function testcase() {
accessed = true; accessed = true;
} }
} }
return accessed;
} finally { assert(accessed, 'accessed !== true');
delete JSON.enumerable;
}
}
runTestCase(testcase);

View File

@ -7,17 +7,12 @@ description: >
Object.defineProperties - 'descObj' is the global object which Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'enumerable' property implements its own [[Get]] method to get 'enumerable' property
(8.10.5 step 3.a) (8.10.5 step 3.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var accessed = false; var accessed = false;
try {
fnGlobalObject().enumerable = true; fnGlobalObject().enumerable = true;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -28,9 +23,5 @@ function testcase() {
accessed = true; accessed = true;
} }
} }
return accessed;
} finally { assert(accessed, 'accessed !== true');
delete fnGlobalObject().enumerable;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,10 @@ description: >
Object.defineProperties - 'descObj' is the Math object which Object.defineProperties - 'descObj' is the Math object which
implements its own [[Get]] method to get 'configurable' property implements its own [[Get]] method to get 'configurable' property
(8.10.5 step 4.a) (8.10.5 step 4.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Math.configurable = true; Math.configurable = true;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -25,9 +21,5 @@ function testcase() {
delete obj.prop; delete obj.prop;
var result2 = obj.hasOwnProperty("prop"); var result2 = obj.hasOwnProperty("prop");
return result1 === true && result2 === false; assert.sameValue(result1, true, 'result1');
} finally { assert.sameValue(result2, false, 'result2');
delete Math.configurable;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,10 @@ description: >
Object.defineProperties - 'descObj' is the JSON object which Object.defineProperties - 'descObj' is the JSON object which
implements its own [[Get]] method to get 'configurable' property implements its own [[Get]] method to get 'configurable' property
(8.10.5 step 4.a) (8.10.5 step 4.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
JSON.configurable = true; JSON.configurable = true;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -25,9 +21,5 @@ function testcase() {
delete obj.prop; delete obj.prop;
var result2 = obj.hasOwnProperty("prop"); var result2 = obj.hasOwnProperty("prop");
return result1 === true && result2 === false; assert.sameValue(result1, true, 'result1');
} finally { assert.sameValue(result2, false, 'result2');
delete JSON.configurable;
}
}
runTestCase(testcase);

View File

@ -7,16 +7,11 @@ description: >
Object.defineProperties - 'descObj' is the global object which Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'configurable' property implements its own [[Get]] method to get 'configurable' property
(8.10.5 step 4.a) (8.10.5 step 4.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
fnGlobalObject().configurable = true; fnGlobalObject().configurable = true;
Object.defineProperties(obj, { Object.defineProperties(obj, {
@ -27,9 +22,5 @@ function testcase() {
delete obj.prop; delete obj.prop;
var result2 = obj.hasOwnProperty("prop"); var result2 = obj.hasOwnProperty("prop");
return result1 === true && result2 === false; assert.sameValue(result1, true, 'result1');
} finally { assert.sameValue(result2, false, 'result2');
delete fnGlobalObject().configurable;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,12 @@ description: >
Object.defineProperties - 'O' is an Array, test the length Object.defineProperties - 'O' is an Array, test the length
property of 'O' is own data property that overrides an inherited property of 'O' is own data property that overrides an inherited
data property (15.4.5.1 step 1) data property (15.4.5.1 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arrProtoLen; var arrProtoLen;
var arr = [0, 1, 2]; var arr = [0, 1, 2];
try {
assert.throws(TypeError, function() {
arrProtoLen = Array.prototype.length; arrProtoLen = Array.prototype.length;
Array.prototype.length = 0; Array.prototype.length = 0;
@ -25,14 +23,10 @@ function testcase() {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { value: 1 } length: { value: 1 }
}); });
return false; });
} catch (e) {
var desc = Object.getOwnPropertyDescriptor(arr, "length");
return e instanceof TypeError && desc.value === 3 && var desc = Object.getOwnPropertyDescriptor(arr, "length");
desc.writable && !desc.enumerable && !desc.configurable; assert.sameValue(desc.value, 3, 'desc.value');
} finally { assert(desc.writable, 'desc.writable !== true');
Array.prototype.length = arrProtoLen; assert.sameValue(desc.enumerable, false, 'desc.enumerable');
} assert.sameValue(desc.configurable, false, 'desc.configurable');
}
runTestCase(testcase);

View File

@ -9,13 +9,10 @@ description: >
of the length property, test the [[Configurable]] attribute of of the length property, test the [[Configurable]] attribute of
inherited data property with large index named in 'O' can't stop inherited data property with large index named in 'O' can't stop
deleting index named properties (15.4.5.1 step 3.l.ii) deleting index named properties (15.4.5.1 step 3.l.ii)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
try {
Array.prototype[1] = 2; //we are not allowed to set the [[Configurable]] attribute of property "1" to false here, since Array.prototype is a global object, and non-configurbale property can't revert to configurable Array.prototype[1] = 2; //we are not allowed to set the [[Configurable]] attribute of property "1" to false here, since Array.prototype is a global object, and non-configurbale property can't revert to configurable
Object.defineProperties(arr, { Object.defineProperties(arr, {
@ -24,9 +21,7 @@ function testcase() {
} }
}); });
return arr.length === 1 && !arr.hasOwnProperty("1") && arr[0] === 0 && Array.prototype[1] === 2; assert.sameValue(arr.length, 1, 'arr.length');
} finally { assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")');
delete Array.prototype[1]; assert.sameValue(arr[0], 0, 'arr[0]');
} assert.sameValue(Array.prototype[1], 2, 'Array.prototype[1]');
}
runTestCase(testcase);

View File

@ -10,13 +10,11 @@ description: >
own data property with large index named in 'O' that overrides own data property with large index named in 'O' that overrides
inherited data property can stop deleting index named properties inherited data property can stop deleting index named properties
(15.4.5.1 step 3.l.ii) (15.4.5.1 step 3.l.ii)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
try {
assert.throws(TypeError, function() {
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
configurable: false configurable: false
}); });
@ -28,12 +26,8 @@ function testcase() {
value: 1 value: 1
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 2, 'arr.length');
return e instanceof TypeError && arr.length === 2 && assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true');
arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 1; assert.sameValue(arr[0], 0, 'arr[0]');
} finally { assert.sameValue(arr[1], 1, 'arr[1]');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -10,13 +10,11 @@ description: >
own data property with large index named in 'O' that overrides own data property with large index named in 'O' that overrides
inherited accessor property can stop deleting index named inherited accessor property can stop deleting index named
properties (15.4.5.1 step 3.l.ii) properties (15.4.5.1 step 3.l.ii)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
try {
assert.throws(TypeError, function() {
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
configurable: false configurable: false
}); });
@ -33,13 +31,9 @@ function testcase() {
value: 1 value: 1
} }
}); });
});
return false; assert.sameValue(arr.length, 2, 'arr.length');
} catch (e) { assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true');
return e instanceof TypeError && arr.length === 2 && arr.hasOwnProperty("1") && assert.sameValue(arr[0], 0, 'arr[0]');
arr[0] === 0 && arr[1] === 1 && Array.prototype[1] === 2; assert.sameValue(arr[1], 1, 'arr[1]');
} finally { assert.sameValue(Array.prototype[1], 2, 'Array.prototype[1]');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -6,12 +6,8 @@ es5id: 15.2.3.7-6-a-17
description: > description: >
Object.defineProperties - 'O' is the Math object which implements Object.defineProperties - 'O' is the Math object which implements
its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Math, "prop", { Object.defineProperty(Math, "prop", {
value: 11, value: 11,
writable: true, writable: true,
@ -24,9 +20,6 @@ function testcase() {
value: 12 value: 12
} }
}); });
return hasProperty && Math.prop === 12;
} finally { assert(hasProperty, 'hasProperty !== true');
delete Math.prop; assert.sameValue(Math.prop, 12, 'Math.prop');
}
}
runTestCase(testcase);

View File

@ -9,13 +9,10 @@ description: >
of the length property, test the [[Configurable]] attribute of of the length property, test the [[Configurable]] attribute of
inherited accessor property with large index named in 'O' can't inherited accessor property with large index named in 'O' can't
stop deleting index named properties (15.4.5.1 step 3.l.ii) stop deleting index named properties (15.4.5.1 step 3.l.ii)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
try {
Object.defineProperty(Array.prototype, "1", { Object.defineProperty(Array.prototype, "1", {
get: function () { get: function () {
return 1; return 1;
@ -29,9 +26,7 @@ function testcase() {
} }
}); });
return arr.length === 1 && !arr.hasOwnProperty("1") && arr[0] === 0 && Array.prototype[1] === 1; assert.sameValue(arr.length, 1, 'arr.length');
} finally { assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")');
delete Array.prototype[1]; assert.sameValue(arr[0], 0, 'arr[0]');
} assert.sameValue(Array.prototype[1], 1, 'Array.prototype[1]');
}
runTestCase(testcase);

View File

@ -10,13 +10,11 @@ description: >
own accessor property with large index named in 'O' that overrides own accessor property with large index named in 'O' that overrides
inherited data property can stop deleting index named properties inherited data property can stop deleting index named properties
(15.4.5.1 step 3.l.ii) (15.4.5.1 step 3.l.ii)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
try {
assert.throws(TypeError, function() {
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
get: function () { get: function () {
return 2; return 2;
@ -31,12 +29,8 @@ function testcase() {
value: 1 value: 1
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 2, 'arr.length');
return e instanceof TypeError && arr.length === 2 && assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true');
arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 2; assert.sameValue(arr[0], 0, 'arr[0]');
} finally { assert.sameValue(arr[1], 2, 'arr[1]');
delete Array.prototype[1];
}
}
runTestCase(testcase);

View File

@ -10,13 +10,11 @@ description: >
own accessor property with large index named in 'O' that overrides own accessor property with large index named in 'O' that overrides
inherited accessor property can stop deleting index named inherited accessor property can stop deleting index named
properties (15.4.5.1 step 3.l.ii) properties (15.4.5.1 step 3.l.ii)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
try {
assert.throws(TypeError, function() {
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
get: function () { get: function () {
return 1; return 1;
@ -36,12 +34,9 @@ function testcase() {
value: 1 value: 1
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 2, 'arr.length');
return e instanceof TypeError && arr.length === 2 && arr.hasOwnProperty("1") && assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true');
arr[0] === 0 && arr[1] === 1 && Array.prototype[1] === 2; assert.sameValue(arr[0], 0, 'arr[0]');
} finally { assert.sameValue(arr[1], 1, 'arr[1]');
delete Array.prototype[1]; assert.sameValue(Array.prototype[1], 2, 'Array.prototype[1]');
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.2.3.7-6-a-187
description: > description: >
Object.defineProperties - 'O' is an Array, 'P' is an array index Object.defineProperties - 'O' is an Array, 'P' is an array index
named property, 'P' is inherited data property (15.4.5.1 step 4.c) named property, 'P' is inherited data property (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
value: 11, value: 11,
configurable: true configurable: true
@ -23,9 +20,7 @@ function testcase() {
configurable: false configurable: false
} }
}); });
return arr.hasOwnProperty("0") && typeof arr[0] === "undefined" && Array.prototype[0] === 11;
} finally { assert(arr.hasOwnProperty("0"), 'arr.hasOwnProperty("0") !== true');
delete Array.prototype[0]; assert.sameValue(typeof arr[0], "undefined", 'typeof arr[0]');
} assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]');
}
runTestCase(testcase);

View File

@ -7,17 +7,16 @@ description: >
Object.defineProperties - 'O' is an Array, 'P' is an array index Object.defineProperties - 'O' is an Array, 'P' is an array index
named property, 'P' is own data property that overrides an named property, 'P' is own data property that overrides an
inherited data property (15.4.5.1 step 4.c) inherited data property (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var arr = [];
try {
assert.throws(TypeError, function() {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
value: 11, value: 11,
configurable: true configurable: true
}); });
var arr = [];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
value: 12, value: 12,
configurable: false configurable: false
@ -28,11 +27,6 @@ function testcase() {
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr[0], 12, 'arr[0]');
return e instanceof TypeError && arr[0] === 12 && Array.prototype[0] === 11; assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,11 @@ description: >
Object.defineProperties - 'O' is an Array, 'P' is an array index Object.defineProperties - 'O' is an Array, 'P' is an array index
named property, 'P' is own data property that overrides an named property, 'P' is own data property that overrides an
inherited accessor property (15.4.5.1 step 4.c) inherited accessor property (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var arr = [];
try {
assert.throws(TypeError, function() {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 11; return 11;
@ -19,7 +19,6 @@ function testcase() {
configurable: true configurable: true
}); });
var arr = [];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
value: 12, value: 12,
configurable: false configurable: false
@ -30,11 +29,6 @@ function testcase() {
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr[0], 12, 'arr[0]');
return e instanceof TypeError && arr[0] === 12 && Array.prototype[0] === 11; assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,11 +6,8 @@ es5id: 15.2.3.7-6-a-191
description: > description: >
Object.defineProperties - 'O' is an Array, 'P' is an array index Object.defineProperties - 'O' is an Array, 'P' is an array index
property, 'P' is inherited accessor property (15.4.5.1 step 4.c) property, 'P' is inherited accessor property (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 11; return 11;
@ -28,9 +25,7 @@ function testcase() {
configurable: false configurable: false
} }
}); });
return arr.hasOwnProperty("0") && arr[0] === 12 && Array.prototype[0] === 11;
} finally { assert(arr.hasOwnProperty("0"), 'arr.hasOwnProperty("0") !== true');
delete Array.prototype[0]; assert.sameValue(arr[0], 12, 'arr[0]');
} assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]');
}
runTestCase(testcase);

View File

@ -7,17 +7,16 @@ description: >
Object.defineProperties - 'O' is an Array, 'P' is an array index Object.defineProperties - 'O' is an Array, 'P' is an array index
named property, 'P' is own accessor property that overrides an named property, 'P' is own accessor property that overrides an
inherited data property (15.4.5.1 step 4.c) inherited data property (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var arr = [];
try {
assert.throws(TypeError, function() {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
value: 11, value: 11,
configurable: true configurable: true
}); });
var arr = [];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
get: function () { get: function () {
return 12; return 12;
@ -30,11 +29,6 @@ function testcase() {
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr[0], 12, 'arr[0]');
return e instanceof TypeError && arr[0] === 12 && Array.prototype[0] === 11; assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -7,11 +7,11 @@ description: >
Object.defineProperties - 'O' is an Array, 'P' is an array index Object.defineProperties - 'O' is an Array, 'P' is an array index
named property, 'P' is own accessor property that overrides an named property, 'P' is own accessor property that overrides an
inherited accessor property (15.4.5.1 step 4.c) inherited accessor property (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var arr = [];
try {
assert.throws(TypeError, function() {
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
get: function () { get: function () {
return 11; return 11;
@ -19,7 +19,6 @@ function testcase() {
configurable: true configurable: true
}); });
var arr = [];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
get: function () { get: function () {
return 12; return 12;
@ -32,11 +31,6 @@ function testcase() {
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr[0], 12, 'arr[0]');
return e instanceof TypeError && arr[0] === 12 && Array.prototype[0] === 11; assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]');
} finally {
delete Array.prototype[0];
}
}
runTestCase(testcase);

View File

@ -6,12 +6,8 @@ es5id: 15.2.3.7-6-a-20
description: > description: >
Object.defineProperties - 'O' is a JSON object which implements Object.defineProperties - 'O' is a JSON object which implements
its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
Object.defineProperty(JSON, "prop", { Object.defineProperty(JSON, "prop", {
value: 11, value: 11,
writable: true, writable: true,
@ -23,9 +19,6 @@ function testcase() {
value: 12 value: 12
} }
}); });
return hasProperty && JSON.prop === 12;
} finally { assert(hasProperty, 'hasProperty !== true');
delete JSON.prop; assert.sameValue(JSON.prop, 12, 'JSON.prop');
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a Function object which Object.defineProperty - 'Attributes' is a Function object which
implements its own [[Get]] method to access the 'value' property implements its own [[Get]] method to access the 'value' property
of prototype object (8.10.5 step 5.a) of prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Function.prototype.value = "Function"; Function.prototype.value = "Function";
var funObj = function (a, b) { var funObj = function (a, b) {
return a + b; return a + b;
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", funObj); Object.defineProperty(obj, "property", funObj);
return obj.property === "Function"; assert.sameValue(obj.property, "Function", 'obj.property');
} finally {
delete Function.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is an Array object that uses Object.defineProperty - 'Attributes' is an Array object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Array.prototype.value = "Array"; Array.prototype.value = "Array";
var arrObj = [1, 2, 3]; var arrObj = [1, 2, 3];
Object.defineProperty(obj, "property", arrObj); Object.defineProperty(obj, "property", arrObj);
return obj.property === "Array"; assert.sameValue(obj.property, "Array", 'obj.property');
} finally {
delete Array.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is a String object that uses Object.defineProperty - 'Attributes' is a String object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
String.prototype.value = "String"; String.prototype.value = "String";
var strObj = new String("abc"); var strObj = new String("abc");
Object.defineProperty(obj, "property", strObj); Object.defineProperty(obj, "property", strObj);
return obj.property === "String"; assert.sameValue(obj.property, "String", 'obj.property');
} finally {
delete String.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is a Boolean object that uses Object.defineProperty - 'Attributes' is a Boolean object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Boolean.prototype.value = "Boolean"; Boolean.prototype.value = "Boolean";
var boolObj = new Boolean(true); var boolObj = new Boolean(true);
Object.defineProperty(obj, "property", boolObj); Object.defineProperty(obj, "property", boolObj);
return obj.property === "Boolean"; assert.sameValue(obj.property, "Boolean", 'obj.property');
} finally {
delete Boolean.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is a Number object that uses Object.defineProperty - 'Attributes' is a Number object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Number.prototype.value = "Number"; Number.prototype.value = "Number";
var numObj = new Number(-2); var numObj = new Number(-2);
Object.defineProperty(obj, "property", numObj); Object.defineProperty(obj, "property", numObj);
return obj.property === "Number"; assert.sameValue(obj.property, "Number", 'obj.property');
} finally {
delete Number.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Object.defineProperty - 'Attributes' is the Math object that uses Object.defineProperty - 'Attributes' is the Math object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.value = "Math"; Object.prototype.value = "Math";
Object.defineProperty(obj, "property", Math); Object.defineProperty(obj, "property", Math);
return obj.property === "Math"; assert.sameValue(obj.property, "Math", 'obj.property');
} finally {
delete Object.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Object.defineProperty - 'Attributes' is the Math object that uses Object.defineProperty - 'Attributes' is the Math object that uses
Object's [[Get]] method to access the 'value' property (8.10.5 Object's [[Get]] method to access the 'value' property (8.10.5
step 5.a) step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Math.value = "Math"; Math.value = "Math";
Object.defineProperty(obj, "property", Math); Object.defineProperty(obj, "property", Math);
return obj.property === "Math"; assert.sameValue(obj.property, "Math", 'obj.property');
} finally {
delete Math.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is a Date object that uses Object.defineProperty - 'Attributes' is a Date object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Date.prototype.value = "Date"; Date.prototype.value = "Date";
var dateObj = new Date(); var dateObj = new Date();
Object.defineProperty(obj, "property", dateObj); Object.defineProperty(obj, "property", dateObj);
return obj.property === "Date"; assert.sameValue(obj.property, "Date", 'obj.property');
} finally {
delete Date.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is a RegExp object that uses Object.defineProperty - 'Attributes' is a RegExp object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
RegExp.prototype.value = "RegExp"; RegExp.prototype.value = "RegExp";
var regObj = new RegExp(); var regObj = new RegExp();
Object.defineProperty(obj, "property", regObj); Object.defineProperty(obj, "property", regObj);
return obj.property === "RegExp"; assert.sameValue(obj.property, "RegExp", 'obj.property');
} finally {
delete RegExp.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Object.defineProperty - 'Attributes' is the JSON object that uses Object.defineProperty - 'Attributes' is the JSON object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.value = "JSON"; Object.prototype.value = "JSON";
Object.defineProperty(obj, "property", JSON); Object.defineProperty(obj, "property", JSON);
return obj.property === "JSON"; assert.sameValue(obj.property, "JSON", 'obj.property');
} finally {
delete Object.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,12 @@ description: >
Object.defineProperty - 'Attributes' is the JSON object that uses Object.defineProperty - 'Attributes' is the JSON object that uses
Object's [[Get]] method to access the 'value' property (8.10.5 Object's [[Get]] method to access the 'value' property (8.10.5
step 5.a) step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
JSON.value = "JSON"; JSON.value = "JSON";
Object.defineProperty(obj, "property", JSON); Object.defineProperty(obj, "property", JSON);
return obj.property === "JSON"; assert.sameValue(obj.property, "JSON", 'obj.property');
} finally {
delete JSON.value;
}
}
runTestCase(testcase);

View File

@ -7,20 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is an Error object that uses Object.defineProperty - 'Attributes' is an Error object that uses
Object's [[Get]] method to access the 'value' property of Object's [[Get]] method to access the 'value' property of
prototype object (8.10.5 step 5.a) prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Error.prototype.value = "Error"; Error.prototype.value = "Error";
var errObj = new Error(); var errObj = new Error();
Object.defineProperty(obj, "property", errObj); Object.defineProperty(obj, "property", errObj);
return obj.property === "Error"; assert.sameValue(obj.property, "Error", 'obj.property');
} finally {
delete Error.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,21 +7,14 @@ description: >
Object.defineProperty - 'Attributes' is an Arguments object which Object.defineProperty - 'Attributes' is an Arguments object which
implements its own [[Get]] method to access the 'value' property implements its own [[Get]] method to access the 'value' property
of prototype object (8.10.5 step 5.a) of prototype object (8.10.5 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.value = "arguments"; Object.prototype.value = "arguments";
var argObj = (function () { return arguments; })(); var argObj = (function () { return arguments; })();
Object.defineProperty(obj, "property", argObj); Object.defineProperty(obj, "property", argObj);
return obj.property === "arguments"; assert.sameValue(obj.property, "arguments", 'obj.property');
} finally {
delete Object.prototype.value;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is the global object that Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'value' property uses Object's [[Get]] method to access the 'value' property
(8.10.5 step 5.a) (8.10.5 step 5.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
fnGlobalObject().value = "global"; fnGlobalObject().value = "global";
Object.defineProperty(obj, "property", fnGlobalObject()); Object.defineProperty(obj, "property", fnGlobalObject());
return obj.property === "global"; assert.sameValue(obj.property, "global", 'obj.property');
} finally {
delete fnGlobalObject().value;
}
}
runTestCase(testcase);

View File

@ -7,13 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a Function object which Object.defineProperty - 'Attributes' is a Function object which
implements its own [[Get]] method to access the 'writable' implements its own [[Get]] method to access the 'writable'
property of prototype object (8.10.5 step 6.b) property of prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Function.prototype.writable = true; Function.prototype.writable = true;
var funObj = function (a, b) { var funObj = function (a, b) {
return a + b; return a + b;
@ -27,9 +24,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Function.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is an Array object that uses Object.defineProperty - 'Attributes' is an Array object that uses
Object's [[Get]] method to access the 'writable' property of Object's [[Get]] method to access the 'writable' property of
prototype object (8.10.5 step 6.b) prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Array.prototype.writable = true; Array.prototype.writable = true;
var arrObj = [1, 2, 3]; var arrObj = [1, 2, 3];
@ -24,9 +22,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Array.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a String object that uses Object.defineProperty - 'Attributes' is a String object that uses
Object's [[Get]] method to access the 'writable' property of Object's [[Get]] method to access the 'writable' property of
prototype object (8.10.5 step 6.b) prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
String.prototype.writable = true; String.prototype.writable = true;
var strObj = new String("abc"); var strObj = new String("abc");
@ -24,9 +22,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete String.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a Boolean object that uses Object.defineProperty - 'Attributes' is a Boolean object that uses
Object's [[Get]] method to access the 'writable' property of Object's [[Get]] method to access the 'writable' property of
prototype object (8.10.5 step 6.b) prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Boolean.prototype.writable = true; Boolean.prototype.writable = true;
var boolObj = new Boolean(true); var boolObj = new Boolean(true);
@ -24,9 +22,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Boolean.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a Number object that uses Object.defineProperty - 'Attributes' is a Number object that uses
Object's [[Get]] method to access the 'writable' property of Object's [[Get]] method to access the 'writable' property of
prototype object (8.10.5 step 6.b) prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Number.prototype.writable = true; Number.prototype.writable = true;
var numObj = new Number(-2); var numObj = new Number(-2);
@ -24,9 +22,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Number.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,13 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is the Math object that uses Object.defineProperty - 'Attributes' is the Math object that uses
Object's [[Get]] method to access the 'writable' property of Object's [[Get]] method to access the 'writable' property of
prototype object (8.10.5 step 6.b) prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.writable = true; Object.prototype.writable = true;
Object.defineProperty(obj, "property", Math); Object.defineProperty(obj, "property", Math);
@ -24,9 +21,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Object.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,13 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is the Math object that uses Object.defineProperty - 'Attributes' is the Math object that uses
Object's [[Get]] method to access the 'writable' property (8.10.5 Object's [[Get]] method to access the 'writable' property (8.10.5
step 6.a) step 6.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Math.writable = true; Math.writable = true;
Object.defineProperty(obj, "property", Math); Object.defineProperty(obj, "property", Math);
@ -24,9 +21,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Math.writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a RegExp object that uses Object.defineProperty - 'Attributes' is a RegExp object that uses
Object's [[Get]] method to access the 'writable' property of Object's [[Get]] method to access the 'writable' property of
prototype object (8.10.5 step 6.b) prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
RegExp.prototype.writable = true; RegExp.prototype.writable = true;
var regObj = new RegExp(); var regObj = new RegExp();
@ -25,9 +23,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete RegExp.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,13 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is the JSON object that uses Object.defineProperty - 'Attributes' is the JSON object that uses
Object's [[Get]] method to access the 'writable' property of Object's [[Get]] method to access the 'writable' property of
prototype object (8.10.5 step 6.b) prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.writable = true; Object.prototype.writable = true;
Object.defineProperty(obj, "property", JSON); Object.defineProperty(obj, "property", JSON);
@ -24,9 +21,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Object.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,13 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is the JSON object that uses Object.defineProperty - 'Attributes' is the JSON object that uses
Object's [[Get]] method to access the 'writable' property (8.10.5 Object's [[Get]] method to access the 'writable' property (8.10.5
step 6.a) step 6.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
JSON.writable = true; JSON.writable = true;
Object.defineProperty(obj, "property", JSON); Object.defineProperty(obj, "property", JSON);
@ -24,9 +21,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete JSON.writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is an Error object that uses Object.defineProperty - 'Attributes' is an Error object that uses
Object's [[Get]] method to access the 'writable' property of Object's [[Get]] method to access the 'writable' property of
prototype object (8.10.5 step 6.b) prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Error.prototype.writable = true; Error.prototype.writable = true;
var errObj = new Error(); var errObj = new Error();
@ -25,9 +23,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Error.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is an Arguments object which Object.defineProperty - 'Attributes' is an Arguments object which
implements its own [[Get]] method to access the 'writable' implements its own [[Get]] method to access the 'writable'
property of prototype object (8.10.5 step 6.b) property of prototype object (8.10.5 step 6.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.writable = true; Object.prototype.writable = true;
var argObj = (function () { return arguments; })(); var argObj = (function () { return arguments; })();
@ -25,9 +23,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete Object.prototype.writable;
}
}
runTestCase(testcase);

View File

@ -7,15 +7,11 @@ description: >
Object.defineProperty - 'Attributes' is the global object that Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'writable' property uses Object's [[Get]] method to access the 'writable' property
(8.10.5 step 6.a) (8.10.5 step 6.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
fnGlobalObject().writable = true; fnGlobalObject().writable = true;
Object.defineProperty(obj, "property", fnGlobalObject()); Object.defineProperty(obj, "property", fnGlobalObject());
@ -26,9 +22,5 @@ function testcase() {
var afterWrite = (obj.property === "isWritable"); var afterWrite = (obj.property === "isWritable");
return beforeWrite === true && afterWrite === true; assert.sameValue(beforeWrite, true, 'beforeWrite');
} finally { assert.sameValue(afterWrite, true, 'afterWrite');
delete fnGlobalObject().writable;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a Function object which Object.defineProperty - 'Attributes' is a Function object which
implements its own [[Get]] method to access the 'get' property of implements its own [[Get]] method to access the 'get' property of
prototype object (8.10.5 step 7.a) prototype object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Function.prototype.get = function () { Function.prototype.get = function () {
return "functionGetProperty"; return "functionGetProperty";
}; };
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", funObj); Object.defineProperty(obj, "property", funObj);
return obj.property === "functionGetProperty"; assert.sameValue(obj.property, "functionGetProperty", 'obj.property');
} finally {
delete Function.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is an Array object that uses Object.defineProperty - 'Attributes' is an Array object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Array.prototype.get = function () { Array.prototype.get = function () {
return "arrayGetProperty"; return "arrayGetProperty";
}; };
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", arrObj); Object.defineProperty(obj, "property", arrObj);
return obj.property === "arrayGetProperty"; assert.sameValue(obj.property, "arrayGetProperty", 'obj.property');
} finally {
delete Array.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a String object that uses Object.defineProperty - 'Attributes' is a String object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
String.prototype.get = function () { String.prototype.get = function () {
return "stringGetProperty"; return "stringGetProperty";
}; };
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", strObj); Object.defineProperty(obj, "property", strObj);
return obj.property === "stringGetProperty"; assert.sameValue(obj.property, "stringGetProperty", 'obj.property');
} finally {
delete String.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a Boolean object that uses Object.defineProperty - 'Attributes' is a Boolean object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Boolean.prototype.get = function () { Boolean.prototype.get = function () {
return "booleanGetProperty"; return "booleanGetProperty";
}; };
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", boolObj); Object.defineProperty(obj, "property", boolObj);
return obj.property === "booleanGetProperty"; assert.sameValue(obj.property, "booleanGetProperty", 'obj.property');
} finally {
delete Boolean.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a Number object that uses Object.defineProperty - 'Attributes' is a Number object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Number.prototype.get = function () { Number.prototype.get = function () {
return "numberGetProperty"; return "numberGetProperty";
}; };
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", numObj); Object.defineProperty(obj, "property", numObj);
return obj.property === "numberGetProperty"; assert.sameValue(obj.property, "numberGetProperty", 'obj.property');
} finally {
delete Number.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperty - 'Attributes' is the Math object that uses Object.defineProperty - 'Attributes' is the Math object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.get = function () { Object.prototype.get = function () {
return "mathGetProperty"; return "mathGetProperty";
}; };
Object.defineProperty(obj, "property", Math); Object.defineProperty(obj, "property", Math);
return obj.property === "mathGetProperty"; assert.sameValue(obj.property, "mathGetProperty", 'obj.property');
} finally {
delete Object.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperty - 'Attributes' is the Math object that uses Object.defineProperty - 'Attributes' is the Math object that uses
Object's [[Get]] method to access the 'get' property (8.10.5 step Object's [[Get]] method to access the 'get' property (8.10.5 step
7.a) 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Math.get = function () { Math.get = function () {
return "mathGetProperty"; return "mathGetProperty";
}; };
Object.defineProperty(obj, "property", Math); Object.defineProperty(obj, "property", Math);
return obj.property === "mathGetProperty"; assert.sameValue(obj.property, "mathGetProperty", 'obj.property');
} finally {
delete Math.get;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a Date object that uses Object.defineProperty - 'Attributes' is a Date object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Date.prototype.get = function () { Date.prototype.get = function () {
return "dateGetProperty"; return "dateGetProperty";
}; };
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", dateObj); Object.defineProperty(obj, "property", dateObj);
return obj.property === "dateGetProperty"; assert.sameValue(obj.property, "dateGetProperty", 'obj.property');
} finally {
delete Date.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is a RegExp object that uses Object.defineProperty - 'Attributes' is a RegExp object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
RegExp.prototype.get = function () { RegExp.prototype.get = function () {
return "regExpGetProperty"; return "regExpGetProperty";
}; };
@ -21,9 +19,4 @@ function testcase() {
Object.defineProperty(obj, "property", regObj); Object.defineProperty(obj, "property", regObj);
return obj.property === "regExpGetProperty"; assert.sameValue(obj.property, "regExpGetProperty", 'obj.property');
} finally {
delete RegExp.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperty - 'Attributes' is the JSON object that uses Object.defineProperty - 'Attributes' is the JSON object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.get = function () { Object.prototype.get = function () {
return "jsonGetProperty"; return "jsonGetProperty";
}; };
Object.defineProperty(obj, "property", JSON); Object.defineProperty(obj, "property", JSON);
return obj.property === "jsonGetProperty"; assert.sameValue(obj.property, "jsonGetProperty", 'obj.property');
} finally {
delete Object.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperty - 'Attributes' is the JSON object that uses Object.defineProperty - 'Attributes' is the JSON object that uses
Object's [[Get]] method to access the 'get' property (8.10.5 step Object's [[Get]] method to access the 'get' property (8.10.5 step
7.a) 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
JSON.get = function () { JSON.get = function () {
return "jsonGetProperty"; return "jsonGetProperty";
}; };
Object.defineProperty(obj, "property", JSON); Object.defineProperty(obj, "property", JSON);
return obj.property === "jsonGetProperty"; assert.sameValue(obj.property, "jsonGetProperty", 'obj.property');
} finally {
delete JSON.get;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is an Error object that uses Object.defineProperty - 'Attributes' is an Error object that uses
Object's [[Get]] method to access the 'get' property of prototype Object's [[Get]] method to access the 'get' property of prototype
object (8.10.5 step 7.a) object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Error.prototype.get = function () { Error.prototype.get = function () {
return "errorGetProperty"; return "errorGetProperty";
}; };
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", errObj); Object.defineProperty(obj, "property", errObj);
return obj.property === "errorGetProperty"; assert.sameValue(obj.property, "errorGetProperty", 'obj.property');
} finally {
delete Error.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,10 @@ description: >
Object.defineProperty - 'Attributes' is an Arguments object which Object.defineProperty - 'Attributes' is an Arguments object which
implements its own [[Get]] method to access the 'get' property of implements its own [[Get]] method to access the 'get' property of
prototype object (8.10.5 step 7.a) prototype object (8.10.5 step 7.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
Object.prototype.get = function () { Object.prototype.get = function () {
return "argumentGetProperty"; return "argumentGetProperty";
}; };
@ -20,9 +18,4 @@ function testcase() {
Object.defineProperty(obj, "property", argObj); Object.defineProperty(obj, "property", argObj);
return obj.property === "argumentGetProperty"; assert.sameValue(obj.property, "argumentGetProperty", 'obj.property');
} finally {
delete Object.prototype.get;
}
}
runTestCase(testcase);

View File

@ -7,24 +7,15 @@ description: >
Object.defineProperty - 'Attributes' is the global object that Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'get' property (8.10.5 uses Object's [[Get]] method to access the 'get' property (8.10.5
step 7.a) step 7.a)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
try {
fnGlobalObject().get = function () { fnGlobalObject().get = function () {
return "globalGetProperty"; return "globalGetProperty";
}; };
Object.defineProperty(obj, "property", fnGlobalObject()); Object.defineProperty(obj, "property", fnGlobalObject());
return obj.property === "globalGetProperty"; assert.sameValue(obj.property, "globalGetProperty", 'obj.property');
} finally {
delete fnGlobalObject().get;
}
}
runTestCase(testcase);

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