mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Replace runTestCase with assert.throws [test/built-ins/Object]
This commit is contained in:
parent
1f97345668
commit
f3e919209c
@ -4,16 +4,9 @@
|
||||
/*---
|
||||
es5id: 15.2.3.5-1-1
|
||||
description: Object.create throws TypeError if 'O' is undefined
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create(undefined);
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,16 +4,9 @@
|
||||
/*---
|
||||
es5id: 15.2.3.5-1-3
|
||||
description: Object.create throws TypeError if 'O' is a boolean primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create(true);
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,16 +4,9 @@
|
||||
/*---
|
||||
es5id: 15.2.3.5-1-4
|
||||
description: Object.create throws TypeError if 'O' is a number primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create(2);
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,17 +4,9 @@
|
||||
/*---
|
||||
es5id: 15.2.3.5-1
|
||||
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);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof TypeError) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,20 +6,13 @@ es5id: 15.2.3.5-4-258
|
||||
description: >
|
||||
Object.create - 'get' property of one property in 'Properties' is
|
||||
the primitive value null (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
get: null
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,20 +6,13 @@ es5id: 15.2.3.5-4-259
|
||||
description: >
|
||||
Object.create - 'get' property of one property in 'Properties' is
|
||||
a boolean primitive (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
get: false
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.5-4-26
|
||||
description: >
|
||||
Object.create - TypeError is thrown when own enumerable accessor
|
||||
property of 'Properties' without a get function (15.2.3.7 step 5.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var props = {};
|
||||
Object.defineProperty(props, "prop", {
|
||||
set: function () { },
|
||||
enumerable: true
|
||||
});
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, props);
|
||||
|
||||
return false;
|
||||
} catch (ex) {
|
||||
return ex instanceof TypeError;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,20 +6,13 @@ es5id: 15.2.3.5-4-260
|
||||
description: >
|
||||
Object.create - 'get' property of one property in 'Properties' is
|
||||
a number primitive (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
get: 123
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-261
|
||||
description: >
|
||||
Object.create - 'get' property of one property in 'Properties' is
|
||||
a primitive string (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
get: "string"
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,20 +6,13 @@ es5id: 15.2.3.5-4-262
|
||||
description: >
|
||||
Object.create - 'get' property of one property in 'Properties' is
|
||||
an Array object (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
get: [1, 2, 3]
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -8,11 +8,8 @@ description: >
|
||||
without a get function that overrides an enumerable inherited
|
||||
accessor property in 'Properties' is defined in 'obj' (15.2.3.7
|
||||
step 5.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "prop", {
|
||||
get: function () {
|
||||
@ -29,13 +26,6 @@ function testcase() {
|
||||
set: function () { },
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, child);
|
||||
|
||||
return false;
|
||||
} catch (ex) {
|
||||
return ex instanceof TypeError;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-293
|
||||
description: >
|
||||
Object.create - 'set' property of one property in 'Properties' is
|
||||
a primitive value null (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
set: null
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-294
|
||||
description: >
|
||||
Object.create - 'set' property of one property in 'Properties' is
|
||||
a primitive boolean value true (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
set: true
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-295
|
||||
description: >
|
||||
Object.create - 'set' property of one property in 'Properties' is
|
||||
a primitive number value (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
set: 123
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-296
|
||||
description: >
|
||||
Object.create - 'set' property of one property in 'Properties' is
|
||||
a primitive string value (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
set: "abc"
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,21 +6,13 @@ es5id: 15.2.3.5-4-297
|
||||
description: >
|
||||
Object.create - 'set' property of one property in 'Properties' is
|
||||
an Date object (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
set: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,16 +6,9 @@ es5id: 15.2.3.5-4-3
|
||||
description: >
|
||||
Object.create throws TypeError if 'Properties' is null (15.2.3.7
|
||||
step 2)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, null);
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,23 +6,14 @@ es5id: 15.2.3.5-4-300
|
||||
description: >
|
||||
Object.create - 'set' property of one property in 'Properties' is
|
||||
a host object that isn't callable (8.10.5 step 8.b)
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
set: fnGlobalObject()
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.create - TypeError is thrown if both 'set' property and
|
||||
'value' property of one property in 'Properties' are present
|
||||
(8.10.5 step 9.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
set: function () { },
|
||||
value: 100
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.create - TypeError is thrown if both 'set' property and
|
||||
'writable' property of one property in 'Properties' are present
|
||||
(8.10.5 step 9.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
set: function () { },
|
||||
writable: true
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.create - TypeError is thrown if both 'get' property and
|
||||
'value' property of one property in 'Properties' are present
|
||||
(8.10.5 step 9.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
get: function () { },
|
||||
value: 100
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.create - TypeError is thrown if both 'get' property and
|
||||
'writable' property of one property in 'Properties' are present
|
||||
(8.10.5 step 9.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: {
|
||||
get: function () { },
|
||||
writable: true
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Object.create - ensure that if an exception is thrown it occurs in
|
||||
the correct order relative to prior and subsequent side-effects
|
||||
(15.2.3.7 step 5.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var newObj = {};
|
||||
var props = {};
|
||||
var i = 0;
|
||||
@ -34,12 +31,8 @@ function testcase() {
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
newObj = Object.create({}, props);
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof RangeError) && !newObj.hasOwnProperty("prop1") && i === 2;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(newObj.hasOwnProperty("prop1"), false, 'newObj.hasOwnProperty("prop1")');
|
||||
assert.sameValue(i, 2, 'i');
|
||||
|
@ -6,18 +6,11 @@ es5id: 15.2.3.5-4-41
|
||||
description: >
|
||||
Object.create - value of one property in 'Properties' is undefined
|
||||
(8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: undefined
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,19 +6,11 @@ es5id: 15.2.3.5-4-42
|
||||
description: >
|
||||
Object.create - value of one property in 'Properties' is null
|
||||
(8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: null
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,19 +6,11 @@ es5id: 15.2.3.5-4-43
|
||||
description: >
|
||||
Object.create - value of one property in 'Properties' is false
|
||||
(8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: false
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,18 +6,11 @@ es5id: 15.2.3.5-4-44
|
||||
description: >
|
||||
Object.create - value of one property in 'Properties' is a number
|
||||
primitive (8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: 12
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,18 +6,11 @@ es5id: 15.2.3.5-4-45
|
||||
description: >
|
||||
Object.create - value of one property in 'Properties' is a string
|
||||
(8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.create({}, {
|
||||
prop: "abc"
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,16 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-1-1
|
||||
description: Object.defineProperties throws TypeError if 'O' is undefined
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(undefined, {});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,16 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-1-2
|
||||
description: Object.defineProperties throws TypeError if 'O' is null
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(null, {});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,16 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-1-3
|
||||
description: Object.defineProperties throws TypeError if 'O' is a boolean
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(true, {});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,16 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-1-4
|
||||
description: Object.defineProperties throws TypeError if 'O' is a string
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties("abc", {});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,17 +6,8 @@ es5id: 15.2.3.7-1
|
||||
description: >
|
||||
Object.defineProperties throws TypeError if type of first param is
|
||||
not Object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(0, {});
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof TypeError) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,16 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-2-1
|
||||
description: Object.defineProperties throws TypeError if 'Properties' is null
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties({}, null);
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,16 +6,8 @@ es5id: 15.2.3.7-2-2
|
||||
description: >
|
||||
Object.defineProperties throws TypeError if 'Properties' is
|
||||
undefined
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties({}, undefined);
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,20 +4,12 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-5-b-1
|
||||
description: Object.defineProperties - 'descObj' is undefined (8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: undefined
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && !obj.hasOwnProperty("prop");
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||
|
@ -4,20 +4,12 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-5-b-2
|
||||
description: Object.defineProperties - 'descObj' is null (8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: null
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && !obj.hasOwnProperty("prop"); ;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-218
|
||||
description: >
|
||||
Object.defineProperties - value of 'get' property of 'descObj' is
|
||||
primitive values( value is null) (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
property: {
|
||||
get: null
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-219
|
||||
description: >
|
||||
Object.defineProperties - value of 'get' property of 'descObj' is
|
||||
primitive values( value is boolean) (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
property: {
|
||||
get: false
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-220
|
||||
description: >
|
||||
Object.defineProperties - value of 'get' property of 'descObj' is
|
||||
primitive values( value is number) (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
property: {
|
||||
get: 123
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-221
|
||||
description: >
|
||||
Object.defineProperties - value of 'get' property of 'descObj' is
|
||||
primitive values( value is string) (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
property: {
|
||||
get: "string"
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-222
|
||||
description: >
|
||||
Object.defineProperties - value of 'get' property of 'descObj' is
|
||||
applied to Array object (8.10.5 step 7.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
property: {
|
||||
get: []
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-253
|
||||
description: >
|
||||
Object.defineProperties - value of 'set' property of 'descObj' is
|
||||
primitive values null (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
set: null
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-254
|
||||
description: >
|
||||
Object.defineProperties - value of 'set' property of 'descObj' is
|
||||
primitive values boolean (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
set: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-255
|
||||
description: >
|
||||
Object.defineProperties - value of 'set' property of 'descObj' is
|
||||
primitive values number (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
set: 100
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-256
|
||||
description: >
|
||||
Object.defineProperties - value of 'set' property of 'descObj' is
|
||||
primitive values string (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
set: "abcdef"
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,22 +6,13 @@ es5id: 15.2.3.7-5-b-257
|
||||
description: >
|
||||
Object.defineProperties - value of 'set' property of 'descObj' is
|
||||
an interesting object other than a function (8.10.5 step 8.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
set: []
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,24 +7,15 @@ description: >
|
||||
Object.defineProperties - TypeError is thrown if both 'set'
|
||||
property and 'value' property of 'descObj' are present (8.10.5
|
||||
step 9.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var setFun = function () {};
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 12,
|
||||
set: setFun
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,24 +7,15 @@ description: >
|
||||
Object.defineProperties - TypeError is thrown if both 'set'
|
||||
property and 'writable' property of 'descObj' are present (8.10.5
|
||||
step 9.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var setFun = function () { };
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
writable: true,
|
||||
set: setFun
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,24 +7,15 @@ description: >
|
||||
Object.defineProperties - TypeError is thrown if both 'get'
|
||||
property and 'value' property of 'descObj' are present (8.10.5
|
||||
step 9.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var getFun = function () {};
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 12,
|
||||
get: getFun
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,25 +7,16 @@ description: >
|
||||
Object.defineProperties - TypeError is thrown if both 'get'
|
||||
property and 'writable' property of 'descObj' are present (8.10.5
|
||||
step 9.a)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var getFun = function () {};
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
"prop": {
|
||||
writable: true,
|
||||
get: getFun
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,20 +4,12 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-5-b-3
|
||||
description: Object.defineProperties - 'descObj' is a boolean (8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: true
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && !obj.hasOwnProperty("prop");
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||
|
@ -4,20 +4,12 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-5-b-4
|
||||
description: Object.defineProperties - 'descObj' is a number (8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: 12
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && !obj.hasOwnProperty("prop");
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||
|
@ -4,20 +4,12 @@
|
||||
/*---
|
||||
es5id: 15.2.3.7-5-b-5
|
||||
description: Object.defineProperties - 'descObj' is a string (8.10.5 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: "abc"
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && !obj.hasOwnProperty("prop");
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||
|
@ -6,26 +6,18 @@ es5id: 15.2.3.7-6-a-1
|
||||
description: >
|
||||
Object.defineProperties - 'P' is own existing data property
|
||||
(8.12.9 step 1 )
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
Object.defineProperty(obj, "prop", {
|
||||
value: 11,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 12,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,10 +7,8 @@ description: >
|
||||
Object.defineProperties - 'P' is own accessor property without a
|
||||
get function that overrides an inherited accessor property (8.12.9
|
||||
step 1 )
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "prop", {
|
||||
get: function () {
|
||||
@ -27,17 +25,11 @@ function testcase() {
|
||||
set: function () { },
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 12,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,27 +6,21 @@ es5id: 15.2.3.7-6-a-112
|
||||
description: >
|
||||
Object.defineProperties - 'O' is an Array, test the length
|
||||
property of 'O' is own data property (15.4.5.1 step 1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 1];
|
||||
Object.defineProperty(arr, "1", {
|
||||
value: 1,
|
||||
configurable: false
|
||||
});
|
||||
try {
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: { value: 1 }
|
||||
});
|
||||
return false;
|
||||
} catch (ex) {
|
||||
});
|
||||
var desc = Object.getOwnPropertyDescriptor(arr, "length");
|
||||
|
||||
return ex instanceof TypeError && desc.value === 2 &&
|
||||
desc.writable && !desc.enumerable && !desc.configurable;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(desc.value, 2, 'desc.value');
|
||||
assert(desc.writable, 'desc.writable !== true');
|
||||
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
|
||||
assert.sameValue(desc.configurable, false, 'desc.configurable');
|
||||
|
@ -8,21 +8,11 @@ description: >
|
||||
property of 'O', the [[Value]] field of 'desc' is absent, test
|
||||
TypeError is thrown when updating the [[Configurable]] attribute
|
||||
of the length property from false to true (15.4.5.1 step 3.a.i)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: { configurable: true }
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -8,21 +8,11 @@ description: >
|
||||
property of 'O', the [[Value]] field of 'desc' is absent, test
|
||||
TypeError is thrown when updating the [[Enumerable]] attribute of
|
||||
the length property from false to true (15.4.5.1 step 3.a.i)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: { enumerable: true }
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -8,14 +8,10 @@ description: >
|
||||
property of 'O', the [[Value]] field of 'desc' is absent, test
|
||||
TypeError is thrown when 'desc' is accessor descriptor (15.4.5.1
|
||||
step 3.a.i)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
get: function () {
|
||||
@ -23,10 +19,5 @@ function testcase() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -8,25 +8,15 @@ description: >
|
||||
property of 'O', the [[Value]] field of 'desc' is absent, test
|
||||
TypeError is thrown when updating the [[Writable]] attribute of
|
||||
the length property from false to true (15.4.5.1 step 3.a.i)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
Object.defineProperty(arr, "length", {
|
||||
writable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: { writable: true }
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -7,21 +7,12 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'P' is the length
|
||||
property of 'O', test RangeError is thrown when setting the
|
||||
[[Value]] field of 'desc' to undefined (15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: { value: undefined }
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
property of 'O', test the [[Value]] field of 'desc' is negative
|
||||
number (15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: -9
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
property of 'O', test the [[Value]] field of 'desc' is +Infinity
|
||||
(15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: +Infinity
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
property of 'O', test the [[Value]] field of 'desc' is -Infinity
|
||||
(15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: -Infinity
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,23 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
property of 'O', test the [[Value]] field of 'desc' is NaN
|
||||
(15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: NaN
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
property of 'O', test the [[Value]] field of 'desc' is a string
|
||||
containing a negative number (15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: "-42"
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
property of 'O', test the [[Value]] field of 'desc' is a string
|
||||
containing a decimal number (15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: "200.59"
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
property of 'O', test the [[Value]] field of 'desc' is a string
|
||||
containing +Infinity (15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: "+Infinity"
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
property of 'O', test the [[Value]] field of 'desc' is a string
|
||||
containing -Infinity (15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: "-Infinity"
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'P' is the length
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: "two"
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -8,16 +8,12 @@ description: >
|
||||
property of 'O', test TypeError is thrown when the [[Value]] field
|
||||
of 'desc' is an Object that both toString and valueOf wouldn't
|
||||
return primitive value (15.4.5.1 step 3.c)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
var toStringAccessed = false;
|
||||
var valueOfAccessed = false;
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: {
|
||||
@ -33,10 +29,6 @@ function testcase() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError) && toStringAccessed && valueOfAccessed;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert(toStringAccessed, 'toStringAccessed !== true');
|
||||
assert(valueOfAccessed, 'valueOfAccessed !== true');
|
||||
|
@ -7,23 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: 123.5
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,22 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: -4294967294.5
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,21 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: 4294967296
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -7,21 +7,14 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'name' is the length
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
try {
|
||||
assert.throws(RangeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: 4294967297
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof RangeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -8,27 +8,18 @@ description: >
|
||||
property of 'O', the [[Value]] field of 'desc' is greater than
|
||||
value of the length property, test TypeError is thrown when the
|
||||
length property is not writable (15.4.5.1 step 3.f.i)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [];
|
||||
|
||||
Object.defineProperty(arr, "length", {
|
||||
writable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: 12
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && arr.length === 0;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 0, 'arr.length');
|
||||
|
@ -9,26 +9,20 @@ description: >
|
||||
of the length property, test TypeError is thrown when the
|
||||
[[Writable]] attribute of the length property is false (15.4.5.1
|
||||
step 3.g)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 1];
|
||||
|
||||
Object.defineProperty(arr, "length", {
|
||||
writable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: 0
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && arr.length === 2 && arr[0] === 0 && arr[1] === 1;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 2, 'arr.length');
|
||||
assert.sameValue(arr[0], 0, 'arr[0]');
|
||||
assert.sameValue(arr[1], 1, 'arr[1]');
|
||||
|
@ -8,11 +8,8 @@ description: >
|
||||
property of 'O', the [[Value]] field of 'desc' is less than value
|
||||
of the length property, test the length property is decreased by
|
||||
1 (15.4.5.1 step 3.l.i)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 1, 2];
|
||||
|
||||
Object.defineProperty(arr, "1", {
|
||||
@ -22,17 +19,14 @@ function testcase() {
|
||||
Object.defineProperty(arr, "2", {
|
||||
configurable: true
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && arr.length === 2 &&
|
||||
!arr.hasOwnProperty("2") && arr[0] === 0 && arr[1] === 1;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 2, 'arr.length');
|
||||
assert.sameValue(arr.hasOwnProperty("2"), false, 'arr.hasOwnProperty("2")');
|
||||
assert.sameValue(arr[0], 0, 'arr[0]');
|
||||
assert.sameValue(arr[1], 1, 'arr[1]');
|
||||
|
@ -9,14 +9,10 @@ description: >
|
||||
of the length property, test the [[Configurable]] attribute of
|
||||
own data property with large index named in 'O' can stop deleting
|
||||
index named properties (15.4.5.1 step 3.l.ii)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 1];
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(arr, "1", {
|
||||
configurable: false
|
||||
});
|
||||
@ -26,11 +22,8 @@ function testcase() {
|
||||
value: 1
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError) && arr.length === 2 &&
|
||||
arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 1;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 2, 'arr.length');
|
||||
assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true');
|
||||
assert.sameValue(arr[0], 0, 'arr[0]');
|
||||
assert.sameValue(arr[1], 1, 'arr[1]');
|
||||
|
@ -9,14 +9,10 @@ description: >
|
||||
of the length property, test the [[Configurable]] attribute of
|
||||
own accessor property with large index named in 'O' can stop
|
||||
deleting index named properties (15.4.5.1 step 3.l.ii)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 1];
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(arr, "1", {
|
||||
get: function () {
|
||||
return 1;
|
||||
@ -29,11 +25,8 @@ function testcase() {
|
||||
value: 1
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError) && arr.length === 2 &&
|
||||
arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 1;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 2, 'arr.length');
|
||||
assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true');
|
||||
assert.sameValue(arr[0], 0, 'arr[0]');
|
||||
assert.sameValue(arr[1], 1, 'arr[1]');
|
||||
|
@ -9,26 +9,18 @@ description: >
|
||||
of the length property, test value of the length property is set
|
||||
to the last non-configurable index named property of 'O' plus 1
|
||||
(15.4.5.1 step 3.l.iii.1)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arr = [0, 1, 2, 3];
|
||||
|
||||
Object.defineProperty(arr, "1", {
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
length: {
|
||||
value: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError) && (arr.length === 2);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.length, 2, 'arr.length');
|
||||
|
@ -8,27 +8,21 @@ description: >
|
||||
'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
|
||||
the length property in 'O' (15.4.5.1 step 4.b)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arr = [1, 2, 3];
|
||||
|
||||
Object.defineProperty(arr, "length", {
|
||||
writable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
"3": {
|
||||
value: "abc"
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && arr[0] === 1 &&
|
||||
arr[1] === 2 && arr[2] === 3 && !arr.hasOwnProperty("3");
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr[0], 1, 'arr[0]');
|
||||
assert.sameValue(arr[1], 2, 'arr[1]');
|
||||
assert.sameValue(arr[2], 3, 'arr[2]');
|
||||
assert.sameValue(arr.hasOwnProperty("3"), false, 'arr.hasOwnProperty("3")');
|
||||
|
@ -8,27 +8,22 @@ description: >
|
||||
'P' is an array index named property,[[Writable]] attribute of the
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arr = [1, 2, 3];
|
||||
|
||||
Object.defineProperty(arr, "length", {
|
||||
writable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
"4": {
|
||||
value: "abc"
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && arr[0] === 1 && arr[1] === 2 &&
|
||||
arr[2] === 3 && !arr.hasOwnProperty("3") && !arr.hasOwnProperty("4");
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr[0], 1, 'arr[0]');
|
||||
assert.sameValue(arr[1], 2, 'arr[1]');
|
||||
assert.sameValue(arr[2], 3, 'arr[2]');
|
||||
assert.sameValue(arr.hasOwnProperty("3"), false, 'arr.hasOwnProperty("3")');
|
||||
assert.sameValue(arr.hasOwnProperty("4"), false, 'arr.hasOwnProperty("4")');
|
||||
|
@ -6,26 +6,19 @@ es5id: 15.2.3.7-6-a-186
|
||||
description: >
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arr = [];
|
||||
Object.defineProperty(arr, 0, {
|
||||
value: "ownDataProperty",
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
"0": {
|
||||
value: "abc",
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && arr[0] === "ownDataProperty";
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr[0], "ownDataProperty", 'arr[0]');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-190
|
||||
description: >
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arr = [];
|
||||
|
||||
Object.defineProperty(arr, "0", {
|
||||
@ -18,8 +16,7 @@ function testcase() {
|
||||
},
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
"0": {
|
||||
get: function () {
|
||||
@ -28,9 +25,5 @@ function testcase() {
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && arr[0] === 11;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr[0], 11, 'arr[0]');
|
||||
|
@ -7,22 +7,15 @@ description: >
|
||||
Object.defineProperties - 'O' is an Array, 'P' is an array index
|
||||
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)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arr = [];
|
||||
Object.preventExtensions(arr);
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arr, {
|
||||
"0": {
|
||||
value: 1
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError) && (arr.hasOwnProperty("0") === false);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(arr.hasOwnProperty("0"), false, 'arr.hasOwnProperty("0")');
|
||||
|
@ -7,10 +7,8 @@ description: >
|
||||
Object.defineProperties - 'O' is the Arguments object which
|
||||
implements its own [[GetOwnProperty]] method to get 'P' (8.12.9
|
||||
step 1 )
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arg = function () {
|
||||
return arguments;
|
||||
}();
|
||||
@ -19,17 +17,11 @@ function testcase() {
|
||||
value: 11,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arg, {
|
||||
prop: {
|
||||
value: 12,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,23 +6,16 @@ es5id: 15.2.3.7-6-a-25
|
||||
description: >
|
||||
Object.defineProperties - 'P' doesn't exist in 'O', test TypeError
|
||||
is thrown when 'O' is not extensible (8.12.9 step 3)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
Object.preventExtensions(obj);
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 12,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError && !obj.hasOwnProperty("prop");
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
|
||||
|
@ -9,11 +9,8 @@ description: >
|
||||
of 'O', test TypeError is thrown when updating the [[Get]]
|
||||
attribute value of 'P' which is defined as non-configurable (10.6
|
||||
[[DefineOwnProperty]] step 4)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arg;
|
||||
|
||||
(function fun(a, b, c) {
|
||||
@ -33,18 +30,15 @@ function testcase() {
|
||||
function get_func2() {
|
||||
return 10;
|
||||
}
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arg, {
|
||||
"0": {
|
||||
get: get_func2
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
});
|
||||
var desc = Object.getOwnPropertyDescriptor(arg, "0");
|
||||
return e instanceof TypeError && desc.get === get_func1 && typeof desc.set === "undefined" &&
|
||||
desc.enumerable === false && desc.configurable === false;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(desc.get, get_func1, 'desc.get');
|
||||
assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set');
|
||||
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
|
||||
assert.sameValue(desc.configurable, false, 'desc.configurable');
|
||||
|
@ -9,11 +9,8 @@ description: >
|
||||
of 'O', test TypeError is thrown when updating the [[Set]]
|
||||
attribute value of 'P' which is defined as non-configurable (10.6
|
||||
[[DefineOwnProperty]] step 4)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arg;
|
||||
|
||||
(function fun(a, b, c) {
|
||||
@ -34,18 +31,15 @@ function testcase() {
|
||||
function set_func(value) {
|
||||
arg.setVerifyHelpProp = value;
|
||||
}
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(arg, {
|
||||
"0": {
|
||||
set: set_func
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
});
|
||||
var desc = Object.getOwnPropertyDescriptor(arg, "0");
|
||||
return e instanceof TypeError && desc.get === get_func && typeof desc.set === "undefined" &&
|
||||
desc.enumerable === false && desc.configurable === false;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(desc.get, get_func, 'desc.get');
|
||||
assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set');
|
||||
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
|
||||
assert.sameValue(desc.configurable, false, 'desc.configurable');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-3
|
||||
description: >
|
||||
Object.defineProperties - 'P' is own data property that overrides
|
||||
an inherited data property (8.12.9 step 1 )
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "prop", {
|
||||
value: 11,
|
||||
@ -23,17 +21,11 @@ function testcase() {
|
||||
value: 12,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 13,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-4
|
||||
description: >
|
||||
Object.defineProperties - 'P' is own data property that overrides
|
||||
an inherited accessor property (8.12.9 step 1 )
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "prop", {
|
||||
get: function () {
|
||||
@ -25,17 +23,11 @@ function testcase() {
|
||||
value: 12,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 13,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-7
|
||||
description: >
|
||||
Object.defineProperties - 'P' is own accessor property that
|
||||
overrides an inherited data property (8.12.9 step 1 )
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "prop", {
|
||||
value: 11,
|
||||
@ -25,17 +23,12 @@ function testcase() {
|
||||
},
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 13,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError) && obj.prop === 12;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(obj.prop, 12, 'obj.prop');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.2.3.7-6-a-8
|
||||
description: >
|
||||
Object.defineProperties - 'P' is own accessor property that
|
||||
overrides an inherited accessor property (8.12.9 step 1 )
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var proto = {};
|
||||
Object.defineProperty(proto, "prop", {
|
||||
get: function() {
|
||||
@ -27,17 +25,12 @@ function testcase() {
|
||||
},
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
value: 13,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError) && obj.prop === 12;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
assert.sameValue(obj.prop, 12, 'obj.prop');
|
||||
|
@ -6,26 +6,18 @@ es5id: 15.2.3.7-6-a-9
|
||||
description: >
|
||||
Object.defineProperties - 'P' is own accessor property without a
|
||||
get function (8.12.9 step 1 )
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = {};
|
||||
Object.defineProperty(obj, "prop", {
|
||||
set: function () { },
|
||||
configurable: false
|
||||
});
|
||||
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperties(obj, {
|
||||
prop: {
|
||||
get: function () { },
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return (e instanceof TypeError);
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,15 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.2.3.6-1-1
|
||||
description: Object.defineProperty applied to undefined throws a TypeError
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(undefined, "foo", {});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -4,15 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.2.3.6-1-2
|
||||
description: Object.defineProperty applied to null throws a TypeError
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(null, "foo", {});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,15 +6,8 @@ es5id: 15.2.3.6-1-3
|
||||
description: >
|
||||
Object.defineProperty applied to number primitive throws a
|
||||
TypeError
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
Object.defineProperty(5, "foo", {});
|
||||
return false;
|
||||
} catch (e) {
|
||||
return e instanceof TypeError;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
});
|
||||
|
@ -6,15 +6,8 @@ es5id: 15.2.3.6-1-4
|
||||
description: >
|
||||
Object.defineProperty applied to string primitive throws a
|
||||
TypeError
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
assert.throws(TypeError, function() {
|
||||
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
Loading…
x
Reference in New Issue
Block a user