| 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-111 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'name' and 'desc' are accessor |
| 8 |
properties, name.[[Set]] is present and desc.[[Set]] is undefined |
| 9 |
(8.12.9 step 12) |
| 10 |
---*/ |
| 11 |
|
| 12 |
var obj = {}; |
| 13 |
|
| 14 |
function getFunc() { |
| 15 |
return 10; |
| 16 |
} |
| 17 |
|
| 18 |
function setFunc(value) { |
| 19 |
obj.setVerifyHelpProp = value; |
| 20 |
} |
| 21 |
|
| 22 |
Object.defineProperty(obj, "foo", { |
| 23 |
get: getFunc, |
| 24 |
set: setFunc, |
| 25 |
enumerable: true, |
| 26 |
configurable: true |
| 27 |
}); |
| 28 |
|
| 29 |
Object.defineProperty(obj, "foo", { |
| 30 |
set: undefined, |
| 31 |
get: getFunc |
| 32 |
}); |
| 33 |
|
| 34 |
|
| 35 |
var desc = Object.getOwnPropertyDescriptor(obj, "foo"); |
| 36 |
|
| 37 |
assert(obj.hasOwnProperty("foo"), 'obj.hasOwnProperty("foo") !== true'); |
| 38 |
assert.sameValue(typeof(desc.set), "undefined", 'typeof (desc.set)'); |