mirror of https://github.com/tc39/test262.git
Refactor 2 tests using propertyHelper.js harness
This commit is contained in:
parent
b3c94b3268
commit
b1e8a1cf8d
|
@ -6,6 +6,7 @@ esid: sec-array.prototype.concat
|
||||||
description: >
|
description: >
|
||||||
Array.prototype.concat will concat an Array when index property
|
Array.prototype.concat will concat an Array when index property
|
||||||
(read-only) exists in Array.prototype (Step 5.b.iii.3.b)
|
(read-only) exists in Array.prototype (Step 5.b.iii.3.b)
|
||||||
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
Object.defineProperty(Array.prototype, "0", {
|
Object.defineProperty(Array.prototype, "0", {
|
||||||
|
@ -15,28 +16,11 @@ Object.defineProperty(Array.prototype, "0", {
|
||||||
});
|
});
|
||||||
|
|
||||||
var oldArr = [101];
|
var oldArr = [101];
|
||||||
|
|
||||||
var newArr = Array.prototype.concat.call(oldArr);
|
var newArr = Array.prototype.concat.call(oldArr);
|
||||||
|
|
||||||
var verifyValue = false;
|
verifyProperty(newArr, "0", {
|
||||||
verifyValue = newArr[0] === 101;
|
value: 101,
|
||||||
|
writable: true,
|
||||||
var verifyEnumerable = false;
|
enumerable: true,
|
||||||
for (var p in newArr) {
|
configurable: true,
|
||||||
if (p === "0" && newArr.hasOwnProperty("0")) {
|
});
|
||||||
verifyEnumerable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var verifyWritable = false;
|
|
||||||
newArr[0] = 12;
|
|
||||||
verifyWritable = newArr[0] === 12;
|
|
||||||
|
|
||||||
var verifyConfigurable = false;
|
|
||||||
delete newArr[0];
|
|
||||||
verifyConfigurable = newArr.hasOwnProperty("0");
|
|
||||||
|
|
||||||
assert(verifyValue, 'verifyValue !== true');
|
|
||||||
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
|
|
||||||
assert(verifyEnumerable, 'verifyEnumerable !== true');
|
|
||||||
assert(verifyWritable, 'verifyWritable !== true');
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ esid: sec-array.prototype.concat
|
||||||
description: >
|
description: >
|
||||||
Array.prototype.concat will concat an Array when index property
|
Array.prototype.concat will concat an Array when index property
|
||||||
(read-only) exists in Array.prototype (Step 5.c.i)
|
(read-only) exists in Array.prototype (Step 5.c.i)
|
||||||
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
Object.defineProperty(Array.prototype, "0", {
|
Object.defineProperty(Array.prototype, "0", {
|
||||||
|
@ -16,31 +17,9 @@ Object.defineProperty(Array.prototype, "0", {
|
||||||
|
|
||||||
var newArr = Array.prototype.concat.call(101);
|
var newArr = Array.prototype.concat.call(101);
|
||||||
|
|
||||||
var hasProperty = newArr.hasOwnProperty("0");
|
assert(newArr[0] instanceof Number);
|
||||||
|
verifyProperty(newArr, "0", {
|
||||||
var instanceOfVerify = typeof newArr[0] === "object";
|
writable: true,
|
||||||
|
enumerable: true,
|
||||||
var verifyValue = false;
|
configurable: true,
|
||||||
verifyValue = newArr[0] == 101;
|
});
|
||||||
|
|
||||||
var verifyEnumerable = false;
|
|
||||||
for (var p in newArr) {
|
|
||||||
if (p === "0" && newArr.hasOwnProperty("0")) {
|
|
||||||
verifyEnumerable = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var verifyWritable = false;
|
|
||||||
newArr[0] = 12;
|
|
||||||
verifyWritable = newArr[0] === 12;
|
|
||||||
|
|
||||||
var verifyConfigurable = false;
|
|
||||||
delete newArr[0];
|
|
||||||
verifyConfigurable = newArr.hasOwnProperty("0");
|
|
||||||
|
|
||||||
assert(hasProperty, 'hasProperty !== true');
|
|
||||||
assert(instanceOfVerify, 'instanceOfVerify !== true');
|
|
||||||
assert(verifyValue, 'verifyValue !== true');
|
|
||||||
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
|
|
||||||
assert(verifyEnumerable, 'verifyEnumerable !== true');
|
|
||||||
assert(verifyWritable, 'verifyWritable !== true');
|
|
||||||
|
|
Loading…
Reference in New Issue