| 1 |
// Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es5id: 15.2.3.6-4-620 |
| 6 |
description: > |
| 7 |
ES5 Attributes - all attributes in Array.prototype.reduceRight are |
| 8 |
correct |
| 9 |
---*/ |
| 10 |
|
| 11 |
var desc = Object.getOwnPropertyDescriptor(Array.prototype, "reduceRight"); |
| 12 |
|
| 13 |
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); |
| 14 |
|
| 15 |
var temp = Array.prototype.reduceRight; |
| 16 |
|
| 17 |
Array.prototype.reduceRight = "2010"; |
| 18 |
|
| 19 |
var isWritable = (Array.prototype.reduceRight === "2010"); |
| 20 |
|
| 21 |
var isEnumerable = false; |
| 22 |
|
| 23 |
for (var prop in Array.prototype) { |
| 24 |
if (prop === "reduceRight") { |
| 25 |
isEnumerable = true; |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
delete Array.prototype.reduceRight; |
| 30 |
|
| 31 |
var isConfigurable = !Array.prototype.hasOwnProperty("reduceRight"); |
| 32 |
|
| 33 |
assert(propertyAreCorrect, 'propertyAreCorrect !== true'); |
| 34 |
assert(isWritable, 'isWritable !== true'); |
| 35 |
assert.sameValue(isEnumerable, false, 'isEnumerable'); |
| 36 |
assert(isConfigurable, 'isConfigurable !== true'); |