Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-3-4.js

raw
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 info: |
6 The abtract operation ToPropertyDescriptor is used to package the
7 into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError
8 if the property desc ends up having a mix of accessor and data property elements.
9 es5id: 15.2.3.6-3-4
10 description: >
11 Object.defineProperty throws TypeError if desc has 'set' and
12 'writable' present(8.10.5 step 9.a)
13 ---*/
14
15 var o = {};
16
17 // dummy getter
18 var setter = function() {}
19 var desc = {
20 set: setter,
21 writable: false
22 };
23 assert.throws(TypeError, function() {
24 Object.defineProperty(o, "foo", desc);
25 });
26 assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")');