| 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-613 |
| 6 |
description: ES5 Attributes - all attributes in Object.lastIndexOf are correct |
| 7 |
---*/ |
| 8 |
|
| 9 |
var desc = Object.getOwnPropertyDescriptor(Array.prototype, "lastIndexOf"); |
| 10 |
|
| 11 |
var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); |
| 12 |
|
| 13 |
var temp = Array.prototype.lastIndexOf; |
| 14 |
|
| 15 |
Array.prototype.lastIndexOf = "2010"; |
| 16 |
|
| 17 |
var isWritable = (Array.prototype.lastIndexOf === "2010"); |
| 18 |
|
| 19 |
var isEnumerable = false; |
| 20 |
|
| 21 |
for (var prop in Array.prototype) { |
| 22 |
if (prop === "lastIndexOf") { |
| 23 |
isEnumerable = true; |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
delete Array.prototype.lastIndexOf; |
| 28 |
|
| 29 |
var isConfigurable = !Array.prototype.hasOwnProperty("lastIndexOf"); |
| 30 |
|
| 31 |
assert(propertyAreCorrect, 'propertyAreCorrect !== true'); |
| 32 |
assert(isWritable, 'isWritable !== true'); |
| 33 |
assert.sameValue(isEnumerable, false, 'isEnumerable'); |
| 34 |
assert(isConfigurable, 'isConfigurable !== true'); |