Replace runTestCase with assert.throws [test/built-ins/Object]

This commit is contained in:
André Bargull 2015-08-11 17:43:48 +02:00
parent 1f97345668
commit f3e919209c
238 changed files with 805 additions and 2616 deletions

View File

@ -4,16 +4,9 @@
/*--- /*---
es5id: 15.2.3.5-1-1 es5id: 15.2.3.5-1-1
description: Object.create throws TypeError if 'O' is undefined description: Object.create throws TypeError if 'O' is undefined
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create(undefined); Object.create(undefined);
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,16 +4,9 @@
/*--- /*---
es5id: 15.2.3.5-1-3 es5id: 15.2.3.5-1-3
description: Object.create throws TypeError if 'O' is a boolean primitive description: Object.create throws TypeError if 'O' is a boolean primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create(true); Object.create(true);
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,16 +4,9 @@
/*--- /*---
es5id: 15.2.3.5-1-4 es5id: 15.2.3.5-1-4
description: Object.create throws TypeError if 'O' is a number primitive description: Object.create throws TypeError if 'O' is a number primitive
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create(2); Object.create(2);
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,17 +4,9 @@
/*--- /*---
es5id: 15.2.3.5-1 es5id: 15.2.3.5-1
description: Object.create throws TypeError if type of first param is not Object description: Object.create throws TypeError if type of first param is not Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create(0); Object.create(0);
} });
catch (e) {
if (e instanceof TypeError) {
return true;
}
}
}
runTestCase(testcase);

View File

@ -6,20 +6,13 @@ es5id: 15.2.3.5-4-258
description: > description: >
Object.create - 'get' property of one property in 'Properties' is Object.create - 'get' property of one property in 'Properties' is
the primitive value null (8.10.5 step 7.b) the primitive value null (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
get: null get: null
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,20 +6,13 @@ es5id: 15.2.3.5-4-259
description: > description: >
Object.create - 'get' property of one property in 'Properties' is Object.create - 'get' property of one property in 'Properties' is
a boolean primitive (8.10.5 step 7.b) a boolean primitive (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
get: false get: false
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.5-4-26
description: > description: >
Object.create - TypeError is thrown when own enumerable accessor Object.create - TypeError is thrown when own enumerable accessor
property of 'Properties' without a get function (15.2.3.7 step 5.a) property of 'Properties' without a get function (15.2.3.7 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var props = {}; var props = {};
Object.defineProperty(props, "prop", { Object.defineProperty(props, "prop", {
set: function () { }, set: function () { },
enumerable: true enumerable: true
}); });
try { assert.throws(TypeError, function() {
Object.create({}, props); Object.create({}, props);
});
return false;
} catch (ex) {
return ex instanceof TypeError;
}
}
runTestCase(testcase);

View File

@ -6,20 +6,13 @@ es5id: 15.2.3.5-4-260
description: > description: >
Object.create - 'get' property of one property in 'Properties' is Object.create - 'get' property of one property in 'Properties' is
a number primitive (8.10.5 step 7.b) a number primitive (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
get: 123 get: 123
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-261
description: > description: >
Object.create - 'get' property of one property in 'Properties' is Object.create - 'get' property of one property in 'Properties' is
a primitive string (8.10.5 step 7.b) a primitive string (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
get: "string" get: "string"
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,20 +6,13 @@ es5id: 15.2.3.5-4-262
description: > description: >
Object.create - 'get' property of one property in 'Properties' is Object.create - 'get' property of one property in 'Properties' is
an Array object (8.10.5 step 7.b) an Array object (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
get: [1, 2, 3] get: [1, 2, 3]
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -8,11 +8,8 @@ description: >
without a get function that overrides an enumerable inherited without a get function that overrides an enumerable inherited
accessor property in 'Properties' is defined in 'obj' (15.2.3.7 accessor property in 'Properties' is defined in 'obj' (15.2.3.7
step 5.a) step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "prop", { Object.defineProperty(proto, "prop", {
get: function () { get: function () {
@ -29,13 +26,6 @@ function testcase() {
set: function () { }, set: function () { },
enumerable: true enumerable: true
}); });
assert.throws(TypeError, function() {
try {
Object.create({}, child); Object.create({}, child);
});
return false;
} catch (ex) {
return ex instanceof TypeError;
}
}
runTestCase(testcase);

View File

@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-293
description: > description: >
Object.create - 'set' property of one property in 'Properties' is Object.create - 'set' property of one property in 'Properties' is
a primitive value null (8.10.5 step 8.b) a primitive value null (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
set: null set: null
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-294
description: > description: >
Object.create - 'set' property of one property in 'Properties' is Object.create - 'set' property of one property in 'Properties' is
a primitive boolean value true (8.10.5 step 8.b) a primitive boolean value true (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
set: true set: true
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-295
description: > description: >
Object.create - 'set' property of one property in 'Properties' is Object.create - 'set' property of one property in 'Properties' is
a primitive number value (8.10.5 step 8.b) a primitive number value (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
set: 123 set: 123
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-296
description: > description: >
Object.create - 'set' property of one property in 'Properties' is Object.create - 'set' property of one property in 'Properties' is
a primitive string value (8.10.5 step 8.b) a primitive string value (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
set: "abc" set: "abc"
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-297
description: > description: >
Object.create - 'set' property of one property in 'Properties' is Object.create - 'set' property of one property in 'Properties' is
an Date object (8.10.5 step 8.b) an Date object (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
set: new Date() set: new Date()
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,16 +6,9 @@ es5id: 15.2.3.5-4-3
description: > description: >
Object.create throws TypeError if 'Properties' is null (15.2.3.7 Object.create throws TypeError if 'Properties' is null (15.2.3.7
step 2) step 2)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, null); Object.create({}, null);
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,23 +6,14 @@ es5id: 15.2.3.5-4-300
description: > description: >
Object.create - 'set' property of one property in 'Properties' is Object.create - 'set' property of one property in 'Properties' is
a host object that isn't callable (8.10.5 step 8.b) a host object that isn't callable (8.10.5 step 8.b)
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
set: fnGlobalObject() set: fnGlobalObject()
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.create - TypeError is thrown if both 'set' property and Object.create - TypeError is thrown if both 'set' property and
'value' property of one property in 'Properties' are present 'value' property of one property in 'Properties' are present
(8.10.5 step 9.a) (8.10.5 step 9.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
set: function () { }, set: function () { },
value: 100 value: 100
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.create - TypeError is thrown if both 'set' property and Object.create - TypeError is thrown if both 'set' property and
'writable' property of one property in 'Properties' are present 'writable' property of one property in 'Properties' are present
(8.10.5 step 9.a) (8.10.5 step 9.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
set: function () { }, set: function () { },
writable: true writable: true
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.create - TypeError is thrown if both 'get' property and Object.create - TypeError is thrown if both 'get' property and
'value' property of one property in 'Properties' are present 'value' property of one property in 'Properties' are present
(8.10.5 step 9.a) (8.10.5 step 9.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
get: function () { }, get: function () { },
value: 100 value: 100
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.create - TypeError is thrown if both 'get' property and Object.create - TypeError is thrown if both 'get' property and
'writable' property of one property in 'Properties' are present 'writable' property of one property in 'Properties' are present
(8.10.5 step 9.a) (8.10.5 step 9.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: { prop: {
get: function () { }, get: function () { },
writable: true writable: true
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
Object.create - ensure that if an exception is thrown it occurs in Object.create - ensure that if an exception is thrown it occurs in
the correct order relative to prior and subsequent side-effects the correct order relative to prior and subsequent side-effects
(15.2.3.7 step 5.a) (15.2.3.7 step 5.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var newObj = {}; var newObj = {};
var props = {}; var props = {};
var i = 0; var i = 0;
@ -34,12 +31,8 @@ function testcase() {
}, },
enumerable: true enumerable: true
}); });
assert.throws(RangeError, function() {
try {
newObj = Object.create({}, props); newObj = Object.create({}, props);
return false; });
} catch (e) { assert.sameValue(newObj.hasOwnProperty("prop1"), false, 'newObj.hasOwnProperty("prop1")');
return (e instanceof RangeError) && !newObj.hasOwnProperty("prop1") && i === 2; assert.sameValue(i, 2, 'i');
}
}
runTestCase(testcase);

View File

@ -6,18 +6,11 @@ es5id: 15.2.3.5-4-41
description: > description: >
Object.create - value of one property in 'Properties' is undefined Object.create - value of one property in 'Properties' is undefined
(8.10.5 step 1) (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: undefined prop: undefined
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,19 +6,11 @@ es5id: 15.2.3.5-4-42
description: > description: >
Object.create - value of one property in 'Properties' is null Object.create - value of one property in 'Properties' is null
(8.10.5 step 1) (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: null prop: null
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,19 +6,11 @@ es5id: 15.2.3.5-4-43
description: > description: >
Object.create - value of one property in 'Properties' is false Object.create - value of one property in 'Properties' is false
(8.10.5 step 1) (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: false prop: false
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,18 +6,11 @@ es5id: 15.2.3.5-4-44
description: > description: >
Object.create - value of one property in 'Properties' is a number Object.create - value of one property in 'Properties' is a number
primitive (8.10.5 step 1) primitive (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: 12 prop: 12
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,18 +6,11 @@ es5id: 15.2.3.5-4-45
description: > description: >
Object.create - value of one property in 'Properties' is a string Object.create - value of one property in 'Properties' is a string
(8.10.5 step 1) (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { assert.throws(TypeError, function() {
Object.create({}, { Object.create({}, {
prop: "abc" prop: "abc"
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,16 +4,8 @@
/*--- /*---
es5id: 15.2.3.7-1-1 es5id: 15.2.3.7-1-1
description: Object.defineProperties throws TypeError if 'O' is undefined description: Object.defineProperties throws TypeError if 'O' is undefined
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperties(undefined, {}); Object.defineProperties(undefined, {});
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,16 +4,8 @@
/*--- /*---
es5id: 15.2.3.7-1-2 es5id: 15.2.3.7-1-2
description: Object.defineProperties throws TypeError if 'O' is null description: Object.defineProperties throws TypeError if 'O' is null
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperties(null, {}); Object.defineProperties(null, {});
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,16 +4,8 @@
/*--- /*---
es5id: 15.2.3.7-1-3 es5id: 15.2.3.7-1-3
description: Object.defineProperties throws TypeError if 'O' is a boolean description: Object.defineProperties throws TypeError if 'O' is a boolean
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperties(true, {}); Object.defineProperties(true, {});
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,16 +4,8 @@
/*--- /*---
es5id: 15.2.3.7-1-4 es5id: 15.2.3.7-1-4
description: Object.defineProperties throws TypeError if 'O' is a string description: Object.defineProperties throws TypeError if 'O' is a string
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperties("abc", {}); Object.defineProperties("abc", {});
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,17 +6,8 @@ es5id: 15.2.3.7-1
description: > description: >
Object.defineProperties throws TypeError if type of first param is Object.defineProperties throws TypeError if type of first param is
not Object not Object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperties(0, {}); Object.defineProperties(0, {});
} });
catch (e) {
if (e instanceof TypeError) {
return true;
}
}
}
runTestCase(testcase);

View File

@ -4,16 +4,8 @@
/*--- /*---
es5id: 15.2.3.7-2-1 es5id: 15.2.3.7-2-1
description: Object.defineProperties throws TypeError if 'Properties' is null description: Object.defineProperties throws TypeError if 'Properties' is null
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperties({}, null); Object.defineProperties({}, null);
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,16 +6,8 @@ es5id: 15.2.3.7-2-2
description: > description: >
Object.defineProperties throws TypeError if 'Properties' is Object.defineProperties throws TypeError if 'Properties' is
undefined undefined
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperties({}, undefined); Object.defineProperties({}, undefined);
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,20 +4,12 @@
/*--- /*---
es5id: 15.2.3.7-5-b-1 es5id: 15.2.3.7-5-b-1
description: Object.defineProperties - 'descObj' is undefined (8.10.5 step 1) description: Object.defineProperties - 'descObj' is undefined (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: undefined prop: undefined
}); });
return false; });
} catch (e) { assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
return e instanceof TypeError && !obj.hasOwnProperty("prop");
}
}
runTestCase(testcase);

View File

@ -4,20 +4,12 @@
/*--- /*---
es5id: 15.2.3.7-5-b-2 es5id: 15.2.3.7-5-b-2
description: Object.defineProperties - 'descObj' is null (8.10.5 step 1) description: Object.defineProperties - 'descObj' is null (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: null prop: null
}); });
return false; });
} catch (e) { assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
return e instanceof TypeError && !obj.hasOwnProperty("prop"); ;
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-218
description: > description: >
Object.defineProperties - value of 'get' property of 'descObj' is Object.defineProperties - value of 'get' property of 'descObj' is
primitive values( value is null) (8.10.5 step 7.b) primitive values( value is null) (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
property: { property: {
get: null get: null
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-219
description: > description: >
Object.defineProperties - value of 'get' property of 'descObj' is Object.defineProperties - value of 'get' property of 'descObj' is
primitive values( value is boolean) (8.10.5 step 7.b) primitive values( value is boolean) (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
property: { property: {
get: false get: false
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-220
description: > description: >
Object.defineProperties - value of 'get' property of 'descObj' is Object.defineProperties - value of 'get' property of 'descObj' is
primitive values( value is number) (8.10.5 step 7.b) primitive values( value is number) (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
property: { property: {
get: 123 get: 123
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-221
description: > description: >
Object.defineProperties - value of 'get' property of 'descObj' is Object.defineProperties - value of 'get' property of 'descObj' is
primitive values( value is string) (8.10.5 step 7.b) primitive values( value is string) (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
property: { property: {
get: "string" get: "string"
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-222
description: > description: >
Object.defineProperties - value of 'get' property of 'descObj' is Object.defineProperties - value of 'get' property of 'descObj' is
applied to Array object (8.10.5 step 7.b) applied to Array object (8.10.5 step 7.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
property: { property: {
get: [] get: []
} }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-253
description: > description: >
Object.defineProperties - value of 'set' property of 'descObj' is Object.defineProperties - value of 'set' property of 'descObj' is
primitive values null (8.10.5 step 8.b) primitive values null (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
set: null set: null
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-254
description: > description: >
Object.defineProperties - value of 'set' property of 'descObj' is Object.defineProperties - value of 'set' property of 'descObj' is
primitive values boolean (8.10.5 step 8.b) primitive values boolean (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
set: true set: true
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-255
description: > description: >
Object.defineProperties - value of 'set' property of 'descObj' is Object.defineProperties - value of 'set' property of 'descObj' is
primitive values number (8.10.5 step 8.b) primitive values number (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
set: 100 set: 100
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-256
description: > description: >
Object.defineProperties - value of 'set' property of 'descObj' is Object.defineProperties - value of 'set' property of 'descObj' is
primitive values string (8.10.5 step 8.b) primitive values string (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
set: "abcdef" set: "abcdef"
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-257
description: > description: >
Object.defineProperties - value of 'set' property of 'descObj' is Object.defineProperties - value of 'set' property of 'descObj' is
an interesting object other than a function (8.10.5 step 8.b) an interesting object other than a function (8.10.5 step 8.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
set: [] set: []
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,24 +7,15 @@ description: >
Object.defineProperties - TypeError is thrown if both 'set' Object.defineProperties - TypeError is thrown if both 'set'
property and 'value' property of 'descObj' are present (8.10.5 property and 'value' property of 'descObj' are present (8.10.5
step 9.a) step 9.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var setFun = function () {}; var setFun = function () {};
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 12, value: 12,
set: setFun set: setFun
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,24 +7,15 @@ description: >
Object.defineProperties - TypeError is thrown if both 'set' Object.defineProperties - TypeError is thrown if both 'set'
property and 'writable' property of 'descObj' are present (8.10.5 property and 'writable' property of 'descObj' are present (8.10.5
step 9.a) step 9.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var setFun = function () { }; var setFun = function () { };
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
writable: true, writable: true,
set: setFun set: setFun
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,24 +7,15 @@ description: >
Object.defineProperties - TypeError is thrown if both 'get' Object.defineProperties - TypeError is thrown if both 'get'
property and 'value' property of 'descObj' are present (8.10.5 property and 'value' property of 'descObj' are present (8.10.5
step 9.a) step 9.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var getFun = function () {}; var getFun = function () {};
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 12, value: 12,
get: getFun get: getFun
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,25 +7,16 @@ description: >
Object.defineProperties - TypeError is thrown if both 'get' Object.defineProperties - TypeError is thrown if both 'get'
property and 'writable' property of 'descObj' are present (8.10.5 property and 'writable' property of 'descObj' are present (8.10.5
step 9.a) step 9.a)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var getFun = function () {}; var getFun = function () {};
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
"prop": { "prop": {
writable: true, writable: true,
get: getFun get: getFun
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,20 +4,12 @@
/*--- /*---
es5id: 15.2.3.7-5-b-3 es5id: 15.2.3.7-5-b-3
description: Object.defineProperties - 'descObj' is a boolean (8.10.5 step 1) description: Object.defineProperties - 'descObj' is a boolean (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: true prop: true
}); });
return false; });
} catch (e) { assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
return e instanceof TypeError && !obj.hasOwnProperty("prop");
}
}
runTestCase(testcase);

View File

@ -4,20 +4,12 @@
/*--- /*---
es5id: 15.2.3.7-5-b-4 es5id: 15.2.3.7-5-b-4
description: Object.defineProperties - 'descObj' is a number (8.10.5 step 1) description: Object.defineProperties - 'descObj' is a number (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: 12 prop: 12
}); });
return false; });
} catch (e) { assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
return e instanceof TypeError && !obj.hasOwnProperty("prop");
}
}
runTestCase(testcase);

View File

@ -4,20 +4,12 @@
/*--- /*---
es5id: 15.2.3.7-5-b-5 es5id: 15.2.3.7-5-b-5
description: Object.defineProperties - 'descObj' is a string (8.10.5 step 1) description: Object.defineProperties - 'descObj' is a string (8.10.5 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: "abc" prop: "abc"
}); });
return false; });
} catch (e) { assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
return e instanceof TypeError && !obj.hasOwnProperty("prop");
}
}
runTestCase(testcase);

View File

@ -6,26 +6,18 @@ es5id: 15.2.3.7-6-a-1
description: > description: >
Object.defineProperties - 'P' is own existing data property Object.defineProperties - 'P' is own existing data property
(8.12.9 step 1 ) (8.12.9 step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
Object.defineProperty(obj, "prop", { Object.defineProperty(obj, "prop", {
value: 11, value: 11,
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 12, value: 12,
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Object.defineProperties - 'P' is own accessor property without a Object.defineProperties - 'P' is own accessor property without a
get function that overrides an inherited accessor property (8.12.9 get function that overrides an inherited accessor property (8.12.9
step 1 ) step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "prop", { Object.defineProperty(proto, "prop", {
get: function () { get: function () {
@ -27,17 +25,11 @@ function testcase() {
set: function () { }, set: function () { },
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 12, value: 12,
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,27 +6,21 @@ es5id: 15.2.3.7-6-a-112
description: > 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 (15.4.5.1 step 1) property of 'O' is own data property (15.4.5.1 step 1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
value: 1, value: 1,
configurable: false configurable: false
}); });
try { assert.throws(TypeError, function() {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { value: 1 } length: { value: 1 }
}); });
return false; });
} catch (ex) {
var desc = Object.getOwnPropertyDescriptor(arr, "length"); var desc = Object.getOwnPropertyDescriptor(arr, "length");
return ex instanceof TypeError && desc.value === 2 && assert.sameValue(desc.value, 2, 'desc.value');
desc.writable && !desc.enumerable && !desc.configurable; assert(desc.writable, 'desc.writable !== true');
} assert.sameValue(desc.enumerable, false, 'desc.enumerable');
} assert.sameValue(desc.configurable, false, 'desc.configurable');
runTestCase(testcase);

View File

@ -8,21 +8,11 @@ description: >
property of 'O', the [[Value]] field of 'desc' is absent, test property of 'O', the [[Value]] field of 'desc' is absent, test
TypeError is thrown when updating the [[Configurable]] attribute TypeError is thrown when updating the [[Configurable]] attribute
of the length property from false to true (15.4.5.1 step 3.a.i) of the length property from false to true (15.4.5.1 step 3.a.i)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { configurable: true } length: { configurable: true }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -8,21 +8,11 @@ description: >
property of 'O', the [[Value]] field of 'desc' is absent, test property of 'O', the [[Value]] field of 'desc' is absent, test
TypeError is thrown when updating the [[Enumerable]] attribute of TypeError is thrown when updating the [[Enumerable]] attribute of
the length property from false to true (15.4.5.1 step 3.a.i) the length property from false to true (15.4.5.1 step 3.a.i)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { enumerable: true } length: { enumerable: true }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -8,14 +8,10 @@ description: >
property of 'O', the [[Value]] field of 'desc' is absent, test property of 'O', the [[Value]] field of 'desc' is absent, test
TypeError is thrown when 'desc' is accessor descriptor (15.4.5.1 TypeError is thrown when 'desc' is accessor descriptor (15.4.5.1
step 3.a.i) step 3.a.i)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
get: function () { get: function () {
@ -23,10 +19,5 @@ function testcase() {
} }
} }
}); });
});
return false; assert.sameValue(arr.length, 0, 'arr.length');
} catch (e) {
return e instanceof TypeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -8,25 +8,15 @@ description: >
property of 'O', the [[Value]] field of 'desc' is absent, test property of 'O', the [[Value]] field of 'desc' is absent, test
TypeError is thrown when updating the [[Writable]] attribute of TypeError is thrown when updating the [[Writable]] attribute of
the length property from false to true (15.4.5.1 step 3.a.i) the length property from false to true (15.4.5.1 step 3.a.i)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
Object.defineProperty(arr, "length", { Object.defineProperty(arr, "length", {
writable: false writable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { writable: true } length: { writable: true }
}); });
});
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -7,21 +7,12 @@ description: >
Object.defineProperties - 'O' is an Array, 'P' is the length Object.defineProperties - 'O' is an Array, 'P' is the length
property of 'O', test RangeError is thrown when setting the property of 'O', test RangeError is thrown when setting the
[[Value]] field of 'desc' to undefined (15.4.5.1 step 3.c) [[Value]] field of 'desc' to undefined (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { value: undefined } length: { value: undefined }
}); });
});
return false; assert.sameValue(arr.length, 0, 'arr.length');
} catch (e) {
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test the [[Value]] field of 'desc' is negative property of 'O', test the [[Value]] field of 'desc' is negative
number (15.4.5.1 step 3.c) number (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: -9 value: -9
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test the [[Value]] field of 'desc' is +Infinity property of 'O', test the [[Value]] field of 'desc' is +Infinity
(15.4.5.1 step 3.c) (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: +Infinity value: +Infinity
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test the [[Value]] field of 'desc' is -Infinity property of 'O', test the [[Value]] field of 'desc' is -Infinity
(15.4.5.1 step 3.c) (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: -Infinity value: -Infinity
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,23 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test the [[Value]] field of 'desc' is NaN property of 'O', test the [[Value]] field of 'desc' is NaN
(15.4.5.1 step 3.c) (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: NaN value: NaN
} }
}); });
});
return false; assert.sameValue(arr.length, 0, 'arr.length');
} catch (e) {
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test the [[Value]] field of 'desc' is a string property of 'O', test the [[Value]] field of 'desc' is a string
containing a negative number (15.4.5.1 step 3.c) containing a negative number (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: "-42" value: "-42"
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test the [[Value]] field of 'desc' is a string property of 'O', test the [[Value]] field of 'desc' is a string
containing a decimal number (15.4.5.1 step 3.c) containing a decimal number (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: "200.59" value: "200.59"
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test the [[Value]] field of 'desc' is a string property of 'O', test the [[Value]] field of 'desc' is a string
containing +Infinity (15.4.5.1 step 3.c) containing +Infinity (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: "+Infinity" value: "+Infinity"
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test the [[Value]] field of 'desc' is a string property of 'O', test the [[Value]] field of 'desc' is a string
containing -Infinity (15.4.5.1 step 3.c) containing -Infinity (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: "-Infinity" value: "-Infinity"
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'P' is the length Object.defineProperties - 'O' is an Array, 'P' is the length
property of 'O', test the [[Value]] field of 'desc' is a string property of 'O', test the [[Value]] field of 'desc' is a string
which doesn't convert to a number (15.4.5.1 step 3.c) which doesn't convert to a number (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: "two" value: "two"
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -8,16 +8,12 @@ description: >
property of 'O', test TypeError is thrown when the [[Value]] field property of 'O', test TypeError is thrown when the [[Value]] field
of 'desc' is an Object that both toString and valueOf wouldn't of 'desc' is an Object that both toString and valueOf wouldn't
return primitive value (15.4.5.1 step 3.c) return primitive value (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
var toStringAccessed = false; var toStringAccessed = false;
var valueOfAccessed = false; var valueOfAccessed = false;
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: { value: {
@ -33,10 +29,6 @@ function testcase() {
} }
} }
}); });
});
return false; assert(toStringAccessed, 'toStringAccessed !== true');
} catch (e) { assert(valueOfAccessed, 'valueOfAccessed !== true');
return (e instanceof TypeError) && toStringAccessed && valueOfAccessed;
}
}
runTestCase(testcase);

View File

@ -7,23 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test RangeError is thrown when the [[Value]] property of 'O', test RangeError is thrown when the [[Value]]
field of 'desc' is positive non-integer values (15.4.5.1 step 3.c) field of 'desc' is positive non-integer values (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: 123.5 value: 123.5
} }
}); });
});
return false; assert.sameValue(arr.length, 0, 'arr.length');
} catch (e) {
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test RangeError is thrown when the [[Value]] property of 'O', test RangeError is thrown when the [[Value]]
field of 'desc' is negative non-integer values (15.4.5.1 step 3.c) field of 'desc' is negative non-integer values (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
assert.throws(RangeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: -4294967294.5 value: -4294967294.5
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,21 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test RangeError is thrown when the [[Value]] property of 'O', test RangeError is thrown when the [[Value]]
field of 'desc' is boundary value 2^32 (15.4.5.1 step 3.c) field of 'desc' is boundary value 2^32 (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
try { assert.throws(RangeError, function() {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: 4294967296 value: 4294967296
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -7,21 +7,14 @@ description: >
Object.defineProperties - 'O' is an Array, 'name' is the length Object.defineProperties - 'O' is an Array, 'name' is the length
property of 'O', test RangeError is thrown when the [[Value]] property of 'O', test RangeError is thrown when the [[Value]]
field of 'desc' is boundary value 2^32 + 1 (15.4.5.1 step 3.c) field of 'desc' is boundary value 2^32 + 1 (15.4.5.1 step 3.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
try { assert.throws(RangeError, function() {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: 4294967297 value: 4294967297
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 0, 'arr.length');
return e instanceof RangeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -8,27 +8,18 @@ description: >
property of 'O', the [[Value]] field of 'desc' is greater than property of 'O', the [[Value]] field of 'desc' is greater than
value of the length property, test TypeError is thrown when the value of the length property, test TypeError is thrown when the
length property is not writable (15.4.5.1 step 3.f.i) length property is not writable (15.4.5.1 step 3.f.i)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
Object.defineProperty(arr, "length", { Object.defineProperty(arr, "length", {
writable: false writable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: 12 value: 12
} }
}); });
});
return false; assert.sameValue(arr.length, 0, 'arr.length');
} catch (e) {
return e instanceof TypeError && arr.length === 0;
}
}
runTestCase(testcase);

View File

@ -9,26 +9,20 @@ description: >
of the length property, test TypeError is thrown when the of the length property, test TypeError is thrown when the
[[Writable]] attribute of the length property is false (15.4.5.1 [[Writable]] attribute of the length property is false (15.4.5.1
step 3.g) step 3.g)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
Object.defineProperty(arr, "length", { Object.defineProperty(arr, "length", {
writable: false writable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: 0 value: 0
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 2, 'arr.length');
return e instanceof TypeError && arr.length === 2 && arr[0] === 0 && arr[1] === 1; assert.sameValue(arr[0], 0, 'arr[0]');
} assert.sameValue(arr[1], 1, 'arr[1]');
}
runTestCase(testcase);

View File

@ -8,11 +8,8 @@ description: >
property of 'O', the [[Value]] field of 'desc' is less than value property of 'O', the [[Value]] field of 'desc' is less than value
of the length property, test the length property is decreased by of the length property, test the length property is decreased by
1 (15.4.5.1 step 3.l.i) 1 (15.4.5.1 step 3.l.i)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1, 2]; var arr = [0, 1, 2];
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
@ -22,17 +19,14 @@ function testcase() {
Object.defineProperty(arr, "2", { Object.defineProperty(arr, "2", {
configurable: true configurable: true
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: 1 value: 1
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 2, 'arr.length');
return e instanceof TypeError && arr.length === 2 && assert.sameValue(arr.hasOwnProperty("2"), false, 'arr.hasOwnProperty("2")');
!arr.hasOwnProperty("2") && arr[0] === 0 && arr[1] === 1; assert.sameValue(arr[0], 0, 'arr[0]');
} assert.sameValue(arr[1], 1, 'arr[1]');
}
runTestCase(testcase);

View File

@ -9,14 +9,10 @@ description: >
of the length property, test the [[Configurable]] attribute of of the length property, test the [[Configurable]] attribute of
own data property with large index named in 'O' can stop deleting own data property with large index named in 'O' can stop deleting
index named properties (15.4.5.1 step 3.l.ii) index named properties (15.4.5.1 step 3.l.ii)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1]; var arr = [0, 1];
assert.throws(TypeError, function() {
try {
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
configurable: false configurable: false
}); });
@ -26,11 +22,8 @@ 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 && assert.sameValue(arr[0], 0, 'arr[0]');
arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 1; assert.sameValue(arr[1], 1, 'arr[1]');
}
}
runTestCase(testcase);

View File

@ -9,14 +9,10 @@ description: >
of the length property, test the [[Configurable]] attribute of of the length property, test the [[Configurable]] attribute of
own accessor property with large index named in 'O' can stop own accessor property with large index named in 'O' can 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];
assert.throws(TypeError, function() {
try {
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
get: function () { get: function () {
return 1; return 1;
@ -29,11 +25,8 @@ 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 && assert.sameValue(arr[0], 0, 'arr[0]');
arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 1; assert.sameValue(arr[1], 1, 'arr[1]');
}
}
runTestCase(testcase);

View File

@ -9,26 +9,18 @@ description: >
of the length property, test value of the length property is set of the length property, test value of the length property is set
to the last non-configurable index named property of 'O' plus 1 to the last non-configurable index named property of 'O' plus 1
(15.4.5.1 step 3.l.iii.1) (15.4.5.1 step 3.l.iii.1)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [0, 1, 2, 3]; var arr = [0, 1, 2, 3];
Object.defineProperty(arr, "1", { Object.defineProperty(arr, "1", {
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
length: { length: {
value: 1 value: 1
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.length, 2, 'arr.length');
return (e instanceof TypeError) && (arr.length === 2);
}
}
runTestCase(testcase);

View File

@ -8,27 +8,21 @@ description: >
'P' is an array index named property,[[Writable]] attribute of the 'P' is an array index named property,[[Writable]] attribute of the
length property in 'O' is false, value of 'P' is equal to value of length property in 'O' is false, value of 'P' is equal to value of
the length property in 'O' (15.4.5.1 step 4.b) the length property in 'O' (15.4.5.1 step 4.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [1, 2, 3]; var arr = [1, 2, 3];
Object.defineProperty(arr, "length", { Object.defineProperty(arr, "length", {
writable: false writable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
"3": { "3": {
value: "abc" value: "abc"
} }
}); });
});
return false; assert.sameValue(arr[0], 1, 'arr[0]');
} catch (e) { assert.sameValue(arr[1], 2, 'arr[1]');
return e instanceof TypeError && arr[0] === 1 && assert.sameValue(arr[2], 3, 'arr[2]');
arr[1] === 2 && arr[2] === 3 && !arr.hasOwnProperty("3"); assert.sameValue(arr.hasOwnProperty("3"), false, 'arr.hasOwnProperty("3")');
}
}
runTestCase(testcase);

View File

@ -8,27 +8,22 @@ description: >
'P' is an array index named property,[[Writable]] attribute of the 'P' is an array index named property,[[Writable]] attribute of the
length property in 'O' is false, value of 'P' is bigger than value length property in 'O' is false, value of 'P' is bigger than value
of the length property in 'O' (15.4.5.1 step 4.b) of the length property in 'O' (15.4.5.1 step 4.b)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = [1, 2, 3]; var arr = [1, 2, 3];
Object.defineProperty(arr, "length", { Object.defineProperty(arr, "length", {
writable: false writable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
"4": { "4": {
value: "abc" value: "abc"
} }
}); });
});
return false; assert.sameValue(arr[0], 1, 'arr[0]');
} catch (e) { assert.sameValue(arr[1], 2, 'arr[1]');
return e instanceof TypeError && arr[0] === 1 && arr[1] === 2 && assert.sameValue(arr[2], 3, 'arr[2]');
arr[2] === 3 && !arr.hasOwnProperty("3") && !arr.hasOwnProperty("4"); assert.sameValue(arr.hasOwnProperty("3"), false, 'arr.hasOwnProperty("3")');
} assert.sameValue(arr.hasOwnProperty("4"), false, 'arr.hasOwnProperty("4")');
}
runTestCase(testcase);

View File

@ -6,26 +6,19 @@ es5id: 15.2.3.7-6-a-186
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 own data property (15.4.5.1 step 4.c) named property, 'P' is own data property (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
Object.defineProperty(arr, 0, { Object.defineProperty(arr, 0, {
value: "ownDataProperty", value: "ownDataProperty",
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
"0": { "0": {
value: "abc", value: "abc",
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr[0], "ownDataProperty", 'arr[0]');
return e instanceof TypeError && arr[0] === "ownDataProperty";
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-190
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 own accessor property (15.4.5.1 step 4.c) named property, 'P' is own accessor property (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
Object.defineProperty(arr, "0", { Object.defineProperty(arr, "0", {
@ -18,8 +16,7 @@ function testcase() {
}, },
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
"0": { "0": {
get: function () { get: function () {
@ -28,9 +25,5 @@ function testcase() {
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr[0], 11, 'arr[0]');
return e instanceof TypeError && arr[0] === 11;
}
}
runTestCase(testcase);

View File

@ -7,22 +7,15 @@ 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' property doesn't exist in 'O', test TypeError named property, 'P' property doesn't exist in 'O', test TypeError
is thrown when 'O' is not extensible (15.4.5.1 step 4.c) is thrown when 'O' is not extensible (15.4.5.1 step 4.c)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arr = []; var arr = [];
Object.preventExtensions(arr); Object.preventExtensions(arr);
assert.throws(TypeError, function() {
try {
Object.defineProperties(arr, { Object.defineProperties(arr, {
"0": { "0": {
value: 1 value: 1
} }
}); });
return false; });
} catch (e) { assert.sameValue(arr.hasOwnProperty("0"), false, 'arr.hasOwnProperty("0")');
return (e instanceof TypeError) && (arr.hasOwnProperty("0") === false);
}
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
Object.defineProperties - 'O' is the Arguments object which Object.defineProperties - 'O' is the Arguments object which
implements its own [[GetOwnProperty]] method to get 'P' (8.12.9 implements its own [[GetOwnProperty]] method to get 'P' (8.12.9
step 1 ) step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arg = function () { var arg = function () {
return arguments; return arguments;
}(); }();
@ -19,17 +17,11 @@ function testcase() {
value: 11, value: 11,
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(arg, { Object.defineProperties(arg, {
prop: { prop: {
value: 12, value: 12,
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,23 +6,16 @@ es5id: 15.2.3.7-6-a-25
description: > description: >
Object.defineProperties - 'P' doesn't exist in 'O', test TypeError Object.defineProperties - 'P' doesn't exist in 'O', test TypeError
is thrown when 'O' is not extensible (8.12.9 step 3) is thrown when 'O' is not extensible (8.12.9 step 3)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
Object.preventExtensions(obj); Object.preventExtensions(obj);
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 12, value: 12,
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
return e instanceof TypeError && !obj.hasOwnProperty("prop");
}
}
runTestCase(testcase);

View File

@ -9,11 +9,8 @@ description: >
of 'O', test TypeError is thrown when updating the [[Get]] of 'O', test TypeError is thrown when updating the [[Get]]
attribute value of 'P' which is defined as non-configurable (10.6 attribute value of 'P' which is defined as non-configurable (10.6
[[DefineOwnProperty]] step 4) [[DefineOwnProperty]] step 4)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arg; var arg;
(function fun(a, b, c) { (function fun(a, b, c) {
@ -33,18 +30,15 @@ function testcase() {
function get_func2() { function get_func2() {
return 10; return 10;
} }
try { assert.throws(TypeError, function() {
Object.defineProperties(arg, { Object.defineProperties(arg, {
"0": { "0": {
get: get_func2 get: get_func2
} }
}); });
});
return false;
} catch (e) {
var desc = Object.getOwnPropertyDescriptor(arg, "0"); var desc = Object.getOwnPropertyDescriptor(arg, "0");
return e instanceof TypeError && desc.get === get_func1 && typeof desc.set === "undefined" && assert.sameValue(desc.get, get_func1, 'desc.get');
desc.enumerable === false && desc.configurable === false; assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set');
} assert.sameValue(desc.enumerable, false, 'desc.enumerable');
} assert.sameValue(desc.configurable, false, 'desc.configurable');
runTestCase(testcase);

View File

@ -9,11 +9,8 @@ description: >
of 'O', test TypeError is thrown when updating the [[Set]] of 'O', test TypeError is thrown when updating the [[Set]]
attribute value of 'P' which is defined as non-configurable (10.6 attribute value of 'P' which is defined as non-configurable (10.6
[[DefineOwnProperty]] step 4) [[DefineOwnProperty]] step 4)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var arg; var arg;
(function fun(a, b, c) { (function fun(a, b, c) {
@ -34,18 +31,15 @@ function testcase() {
function set_func(value) { function set_func(value) {
arg.setVerifyHelpProp = value; arg.setVerifyHelpProp = value;
} }
try { assert.throws(TypeError, function() {
Object.defineProperties(arg, { Object.defineProperties(arg, {
"0": { "0": {
set: set_func set: set_func
} }
}); });
});
return false;
} catch (e) {
var desc = Object.getOwnPropertyDescriptor(arg, "0"); var desc = Object.getOwnPropertyDescriptor(arg, "0");
return e instanceof TypeError && desc.get === get_func && typeof desc.set === "undefined" && assert.sameValue(desc.get, get_func, 'desc.get');
desc.enumerable === false && desc.configurable === false; assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set');
} assert.sameValue(desc.enumerable, false, 'desc.enumerable');
} assert.sameValue(desc.configurable, false, 'desc.configurable');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-3
description: > description: >
Object.defineProperties - 'P' is own data property that overrides Object.defineProperties - 'P' is own data property that overrides
an inherited data property (8.12.9 step 1 ) an inherited data property (8.12.9 step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "prop", { Object.defineProperty(proto, "prop", {
value: 11, value: 11,
@ -23,17 +21,11 @@ function testcase() {
value: 12, value: 12,
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 13, value: 13,
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-4
description: > description: >
Object.defineProperties - 'P' is own data property that overrides Object.defineProperties - 'P' is own data property that overrides
an inherited accessor property (8.12.9 step 1 ) an inherited accessor property (8.12.9 step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "prop", { Object.defineProperty(proto, "prop", {
get: function () { get: function () {
@ -25,17 +23,11 @@ function testcase() {
value: 12, value: 12,
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 13, value: 13,
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-7
description: > description: >
Object.defineProperties - 'P' is own accessor property that Object.defineProperties - 'P' is own accessor property that
overrides an inherited data property (8.12.9 step 1 ) overrides an inherited data property (8.12.9 step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "prop", { Object.defineProperty(proto, "prop", {
value: 11, value: 11,
@ -25,17 +23,12 @@ function testcase() {
}, },
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 13, value: 13,
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(obj.prop, 12, 'obj.prop');
return (e instanceof TypeError) && obj.prop === 12;
}
}
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-8
description: > description: >
Object.defineProperties - 'P' is own accessor property that Object.defineProperties - 'P' is own accessor property that
overrides an inherited accessor property (8.12.9 step 1 ) overrides an inherited accessor property (8.12.9 step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "prop", { Object.defineProperty(proto, "prop", {
get: function() { get: function() {
@ -27,17 +25,12 @@ function testcase() {
}, },
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
value: 13, value: 13,
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) { assert.sameValue(obj.prop, 12, 'obj.prop');
return (e instanceof TypeError) && obj.prop === 12;
}
}
runTestCase(testcase);

View File

@ -6,26 +6,18 @@ es5id: 15.2.3.7-6-a-9
description: > description: >
Object.defineProperties - 'P' is own accessor property without a Object.defineProperties - 'P' is own accessor property without a
get function (8.12.9 step 1 ) get function (8.12.9 step 1 )
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
Object.defineProperty(obj, "prop", { Object.defineProperty(obj, "prop", {
set: function () { }, set: function () { },
configurable: false configurable: false
}); });
assert.throws(TypeError, function() {
try {
Object.defineProperties(obj, { Object.defineProperties(obj, {
prop: { prop: {
get: function () { }, get: function () { },
configurable: true configurable: true
} }
}); });
return false; });
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -4,15 +4,8 @@
/*--- /*---
es5id: 15.2.3.6-1-1 es5id: 15.2.3.6-1-1
description: Object.defineProperty applied to undefined throws a TypeError description: Object.defineProperty applied to undefined throws a TypeError
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperty(undefined, "foo", {}); Object.defineProperty(undefined, "foo", {});
return false; });
} catch (e) {
return e instanceof TypeError;
}
}
runTestCase(testcase);

View File

@ -4,15 +4,8 @@
/*--- /*---
es5id: 15.2.3.6-1-2 es5id: 15.2.3.6-1-2
description: Object.defineProperty applied to null throws a TypeError description: Object.defineProperty applied to null throws a TypeError
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperty(null, "foo", {}); Object.defineProperty(null, "foo", {});
return false; });
} catch (e) {
return e instanceof TypeError;
}
}
runTestCase(testcase);

View File

@ -6,15 +6,8 @@ es5id: 15.2.3.6-1-3
description: > description: >
Object.defineProperty applied to number primitive throws a Object.defineProperty applied to number primitive throws a
TypeError TypeError
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperty(5, "foo", {}); Object.defineProperty(5, "foo", {});
return false; });
} catch (e) {
return e instanceof TypeError;
}
}
runTestCase(testcase);

View File

@ -6,15 +6,8 @@ es5id: 15.2.3.6-1-4
description: > description: >
Object.defineProperty applied to string primitive throws a Object.defineProperty applied to string primitive throws a
TypeError TypeError
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
try {
Object.defineProperty("hello\nworld\\!", "foo", {}); Object.defineProperty("hello\nworld\\!", "foo", {});
return false; });
} catch (e) {
return e instanceof TypeError;
}
}
runTestCase(testcase);

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