Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperty/symbol-data-property-configurable.js

raw
1 // Copyright (C) 2013 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 19.1.2.4
5 description: >
6 Symbol used as property for configurable data property definition
7 features: [Symbol]
8 includes: [propertyHelper.js]
9 ---*/
10 var sym = Symbol();
11 var obj = {};
12
13
14 Object.defineProperty(obj, sym, {
15 value: 1,
16 configurable: true
17 });
18
19 assert.sameValue(sym in obj, true, "The result of `sym in obj` is `true`");
20 verifyProperty(obj, sym, {
21 value: 1,
22 configurable: true,
23 writable: false,
24 enumerable: false,
25 });
26
27 assert.sameValue(
28 Object.prototype.propertyIsEnumerable.call(obj, sym),
29 false,
30 "`Object.prototype.propertyIsEnumerable.call(obj, sym)` returns `false`"
31 );
32
33 assert.sameValue(delete obj[sym], true, "The result of `delete obj[sym]` is `true`");
34
35 assert.sameValue(
36 Object.getOwnPropertyDescriptor(obj, sym),
37 undefined,
38 "`Object.getOwnPropertyDescriptor(obj, sym)` returns `undefined`"
39 );
40
41 reportCompare(0, 0);