Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-3-7.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-7
10 description: >
11 Object.defineProperty throws TypeError if getter is not callable
12 but not undefined (String)(8.10.5 step 7.b)
13 ---*/
14
15 var o = {};
16
17 // dummy getter
18 var getter = "abc";
19 var desc = {
20 get: getter
21 };
22 assert.throws(TypeError, function() {
23 Object.defineProperty(o, "foo", desc);
24 });
25 assert.sameValue(o.hasOwnProperty("foo"), false, 'o.hasOwnProperty("foo")');